我正在使用下面的代码从我的联系人那里获取照片..但这是抛出异常..
android.database.sqlite.SQLiteException: unknown error: INTEGER data in getBlob_native.
Run Code Online (Sandbox Code Playgroud)
如果我错过了什么,请帮助我.
int idx = cursor.getColumnIndex(ContactsContract.Contacts.PHOTO_ID);
byte[] img = cursor.getBlob(idx);
ImageView i = (ImageView)findViewById(R.id.ImageView);
Bitmap b = BitmapFactory.decodeByteArray(img, 0, img.length);
Run Code Online (Sandbox Code Playgroud) 我想要一个调试功能来做到这一点,但我不知道一个是否已经存在.通过并为我的每个表使用'drop table'将是一个痛苦.
帮助赞赏.
使用Oracle时,您可以创建一个禁用的触发器,在触发器主体之前指定单词DISABLE.如何在Sql Server中实现相同的效果?
使用Maven surefire,我无法分叉并行测试执行.也就是说,我的每个测试用例都要在serapate JVM中运行,因此就是分叉.另外,我希望我的测试用例并行运行.第一部分工作没有问题:我能够在自己的JVM中运行每个测试用例.第二部分,对我来说仍然是一个挑战.我还没有设法让测试用例的并行执行工作.以下是我的插件声明的样子:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<parallel>methods</parallel>
<forkMode>always</forkMode>
<argLine>-Xms512m -Xmx512m</argLine>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我已经尝试了两种方法和类,但没有看到任何并行化.我的JUnit版本是4.7,如依赖性声明所示:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>compile</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
任何帮助都会得到很多批评.
格雷瓜尔.
我想将xml文件传递给sql server存储过程,如下所示:
CREATE PROCEDURE BookDetails_Insert (@xml xml)
Run Code Online (Sandbox Code Playgroud)
我想比较一些字段数据与其他表数据,如果匹配,则必须将记录插入到表中.
要求:
如何将XML传递给存储过程?我试过这个,但它不起作用:[工作]
command.Parameters.Add(
new SqlParameter("@xml", SqlDbType.Xml)
{
Value = new SqlXml(new XmlTextReader(xmlToSave.InnerXml,
XmlNodeType.Document, null))
});
Run Code Online (Sandbox Code Playgroud)如何访问存储过程中的XML数据?
编辑:[工作]
String sql = "BookDetails_Insert";
XmlDocument xmlToSave = new XmlDocument();
xmlToSave.Load("C:\\Documents and Settings\\Desktop\\XML_Report\\Books_1.xml");
SqlConnection sqlCon = new SqlConnection("...");
using (DbCommand command = sqlCon.CreateCommand())
{
**command.CommandType = CommandType.StoredProcedure;**
command.CommandText = sql;
command.Parameters.Add(
new SqlParameter("@xml", SqlDbType.Xml)
{
Value = new SqlXml(new XmlTextReader(xmlToSave.InnerXml
, XmlNodeType.Document, null))
});
sqlCon.Open();
DbTransaction trans = sqlCon.BeginTransaction();
command.Transaction = trans;
try
{ …Run Code Online (Sandbox Code Playgroud) 在GAE(Python)中,使用webApp Framework,调用self.redirect('some_url')通过GET方法将用户重定向到该URL.是否可以通过POST方法使用一些参数进行(重定向)?
如果可能,怎么样?
谢谢!
我有点困惑.我正在通过我写的基本清理函数运行所有输入,只允许某些字符,但[]仍然允许使用诸如字符之类的字符.
function sanitize($input) {
$pattern = "/[^a-zA-z0-9_-]/";
$filtered = preg_replace($pattern, "", $input);
return $filtered;}
Run Code Online (Sandbox Code Playgroud)
知道为什么这样做吗?
我正在使用邮件消息类发送电子邮件。但如果我检查我的 Gmail 帐户,邮件会作为单独的邮件收到。我想要在一个线程中发送邮件。我也使用相同的主题并尝试在主题之前附加“Re:”。它对我不起作用。如果得到解决方案,我会很高兴。以下是我正在使用的代码。
public static bool SendEmail(
string pGmailEmail,
string pGmailPassword,
string pTo,
string pFrom,
string pSubject,
string pBody,
System.Web.Mail.MailFormat pFormat,
string pAttachmentPath)
{
try
{
System.Web.Mail.MailMessage myMail = new System.Web.Mail.MailMessage();
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/smtpserver",
"smtp.gmail.com");
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/smtpserverport",
"465");
myMail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/sendusing",
"2");
//sendusing: cdoSendUsingPort, value 2, for sending the message using
//the network.
//smtpauthenticate: Specifies the mechanism used when authenticating
//to an SMTP
//service over the network. Possible values are:
//- cdoAnonymous, value 0. Do not authenticate.
//- cdoBasic, value 1. Use …Run Code Online (Sandbox Code Playgroud)