问题列表 - 第32999页

在Android中设置相机图像大小

目前我正在尝试将我的相机设置在我的摩托罗拉Droid手机上以拍摄与我的屏幕尺寸相匹配的图像(854 x 480像素),并且我试图通过相机的参数来完成:

Camera.Parameters parameters = this.mCamera.getParameters();
Log.i(TAG, "CAMERA SIZE: (" + this.mCameraView.getWidth() + ", " + this.mCameraView.getHeight() + ")");
parameters.setPictureSize(this.mCameraView.getWidth(), this.mCameraView.getHeight());
this.mCamera.setParameters(parameters);
this.mCamera.takePicture(null, null, this);
Run Code Online (Sandbox Code Playgroud)

我的活动实现了onPictureTaken的Camera.PictureCallback方法(不包括日志调用),因此当调用takePicture方法时,它运行此方法:

@Override
public void onPictureTaken(byte[] data, Camera camera) {
    Bitmap image = BitmapFactory.decodeByteArray(data, 0, data.length);
    //Size imageSize = camera.getParameters().getPictureSize();
    //image = Bitmap.createBitmap(image, 0, 0, imageSize.width, imageSize.height);
    this.mCameraView.setBackgroundDrawable(new BitmapDrawable(image));
}
Run Code Online (Sandbox Code Playgroud)

出于某种原因,我的相机正在拍摄1280 x 960的照片.这是相机可以拍摄图像的某种最小尺寸吗?从日志调用我可以看到相机的参数仍然设置为854 x 480的图片大小,但图像保持为1280 x 960.我是否正确解码图像,我是否正确设置了相机的参数,或者我我做错了什么?

在此先感谢您提供任何帮助!

此致,celestialorb.

parameters camera android image

9
推荐指数
1
解决办法
3万
查看次数

如何从jQuery对象中获取字符串表示?

真是愚蠢的问题,但是,例如,给出:

var $foo = $('<div>bar</div>');
Run Code Online (Sandbox Code Playgroud)

我该如何'<div>bar</div>'退出?

jquery

5
推荐指数
1
解决办法
2212
查看次数

有没有办法在通用应用程序中为不同的iOS设备指定不同的包显示名称?

我猜不是,但是我想爱错.我想在我的通用应用程序上使用捆绑显示名称,该应用程序在iPad和iPhone 4上显示效果很好,但在较旧的iPhone型号上显示太长(有省略号).我想在前两个平台上指定完整的包显示名称,然后在较旧的iPhone型号上指定一个较短的名称.有没有办法做到这一点?

iphone

5
推荐指数
2
解决办法
1621
查看次数

使用背景图像将热点添加到DIV

是否可以在div中添加带有背景图像的热点?

非常感谢.

埃里克

html css

1
推荐指数
1
解决办法
1万
查看次数

将对象转换为基接口

我有一个问题,将对象转换为生成在另一个库中的其中一个基本接口.这是它的代码:

BaseSDK.dll

public interface IPlugin
{
    void Run();
}
Run Code Online (Sandbox Code Playgroud)

CustomPlugin.Definition.dll:

public interface ICustomPlugin
{
    void DoCustomStuff();
}
Run Code Online (Sandbox Code Playgroud)

CustomPlugin.dll(引用BaseSDK.dll和CustomPlugin.Definition.dll):

public class CustomPlugin: IPlugin, ICustomPlugin
{
    public void Run()
    {

    }

    public void DoCustomStuff()
    {

    }
}
Run Code Online (Sandbox Code Playgroud)

Host.exe(引用BaseSDK.dll和CustomPlugin.Definition.dll):

IPlugin plugin;
public void DoStuff()
{
    plugin = LoadPluginAndCreateAnInstanceSomehow();
    // I know plugin is a CustomPlugin
    ICustomPlugin customPlugin = plugin as ICustomPlugin; //cast fails.
    customPlugin.DoCustomStuff();
}
Run Code Online (Sandbox Code Playgroud)

我不明白; 这只是普通的类型转换类型到它的基类型.我怎样才能解决这个问题?还是其他选择?

编辑:这是一个总结LoadPluginAndCreateAnInstanceSomehow():

Assembly ass = Assembly.LoadFrom(filename);
Type t = ass.GetType(ass.FullName + ".CustomPlugin");
plugin = …
Run Code Online (Sandbox Code Playgroud)

c# inheritance plugins casting interface

5
推荐指数
1
解决办法
2490
查看次数

安装更新前关闭运行程序的版本(Inno Setup)

这应该很简单,我需要在安装程序启动时停止运行任何以前版本的程序.

大多数人建议exe在Inno Setup启动之前制作一个这样做并调用它.我创建了一个exe使用AutoIt来杀死我程序的所有进程.问题是我不知道在安装任何东西之前如何让Inno Setup调用它.

如何在安装文件之前调用可执行文件?

或者,如果我可以检测程序是否正在运行并告诉用户关闭它,那也可以.

installer inno-setup

18
推荐指数
4
解决办法
3万
查看次数

C#登录示例

我无法隐藏登录表单的主表单.用户登录后关闭登录表单并显示主表单.

我一直在困惑自己,我删除了所有代码,并开始新鲜.我可以隐藏登录表单.

我无法隐藏调用的主要表单

Application.Run(new MainForm());
Run Code Online (Sandbox Code Playgroud)

登录表单如下所示:

namespace WindowsFormsApplication1
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string username;
            string password;

            username = TB_username.Text;
            password = TB_password.Text;

            if (User.Login(username, password))
            {
                Globals._Login = true;

                // Close login form
                this.Dispose(false);

            }
            else
            {
                MessageBox.Show("Login Failed");
            }

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚如何隐藏然后在登录过后显示主表单.

谢谢任何例子都会很棒

c# winforms

8
推荐指数
1
解决办法
4万
查看次数

重复GetAccessRules,FileSystemAccessRule条目

我从以下代码中获取了一个重复的FileSystemAccessRule:

C:\inetpub\wwwroot\AspInfo\Account
BUILTIN\IIS_IUSRS : Allow : ReadAndExecute, Synchronize
BUILTIN\IIS_IUSRS : Allow : -1610612736
NT SERVICE\TrustedInstaller : Allow : FullControl
NT SERVICE\TrustedInstaller : Allow : 268435456
Run Code Online (Sandbox Code Playgroud)

而我无法弄清楚它是什么或为什么.

并且显示的权限与我可以看到的文件FileManager属性不匹配.例如,如何从此迭代或类似迭代中找到"列出文件夹内容"权限.如果有人知道.NET文档中的示例,那将会有所帮助.

protected void directoryInfo()
{
  var di = new DirectoryInfo(Server.MapPath("/"));
  foreach (DirectoryInfo dir in di.GetDirectories())
  {
    Response.Write(dir.FullName + "<br/>");
    DirectorySecurity ds = dir.GetAccessControl();
    foreach (FileSystemAccessRule fsar in ds.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount)))
    {
      string userName = fsar.IdentityReference.Value;
      string userRights = fsar.FileSystemRights.ToString();
      string userAccessType = fsar.AccessControlType.ToString();
      Response.Write(userName + " : " + userAccessType + " : " …
Run Code Online (Sandbox Code Playgroud)

c# filesystems permissions file-permissions ntfs

10
推荐指数
1
解决办法
1万
查看次数

将 ImageOutputStream 转换为 byte[]

一直在尝试使用 JAI 将 ImageOutputStream 转换为 byte[] 一段时间。任何输入表示赞赏。谢谢。

抱歉,这是代码片段,我正在处理。我不得不提前发布它。我面临的问题是,我能够从 ImageOutputStream 获取 ByteArrayOutputStream。但它总是给我零字节。但是如果我使用 FileOutputStream 而不是 ByteArrayOuputStream,我可以写入一个非零字节的文件。:

File file = new File("C:/TIFFImages/tiff-image.tiff");
FileInputStream in = new FileInputStream(file);
long filelength = file.length();
byte[] bytes = new byte[(int)filelength]; 
int offset = 0; 
int numRead = 0; 

while (offset < bytes.length && (numRead=in.read(bytes, offset, bytes.length-offset)) >= 0) { 
    offset += numRead; 
} 
if (offset < bytes.length) { 
    throw new IOException("Could not completely read file "+file.getName()); 
} 

ByteArrayInputStream bais = new ByteArrayInputStream(bytes);

RenderedImage src = JAI.create("stream", SeekableStream.wrapInputStream(bais, …
Run Code Online (Sandbox Code Playgroud)

java image jai

5
推荐指数
2
解决办法
2万
查看次数

如何在第一次出现" - "(减号)时将字符串拆分为两个带PHP的$ vars?

如何在第一次出现 - (减号)时将字符串拆分为两个带PHP的$ vars?

我已经找到了如何拆分每个" - ",但不仅仅是在第一次出现时.

例:

this - is - line - of whatever - is - relevant
$var1 = this
$var2 = is - line - of whatever - is - relevant
Run Code Online (Sandbox Code Playgroud)

注意,也剥掉了第一个" - ".

在此先感谢您的帮助!

php split

60
推荐指数
2
解决办法
3万
查看次数