有没有办法用java知道swf文件的原始宽度和高度?
int width, height;
// my stream contains an image or a swf file
InputStream stream = file.getInputStream();
// mediaType has been set with the help of file extension
switch (mediaType)
{
case IMAGE:
BufferedImage img = ImageIO.read(stream);
width = img.getWidth();
height = img.getHeight();
break;
case FLASH:
// what is the code here ?
break;
}
Run Code Online (Sandbox Code Playgroud) 对于使用naked属性声明的函数,编译器生成没有prolog和epilog代码的代码.您可以使用此功能使用内联汇编程序代码编写自己的prolog/epilog代码序列.裸函数在编写虚拟设备驱动程序时特别有用.
__declspec(naked) declarator
Run Code Online (Sandbox Code Playgroud)
什么是"prolog和epilog代码".我看到用C语言编写的库只在libc上运行在设备或固件上.它调用函数没有问题,naked关键字做了什么以及为什么需要它?
注意:我不确定函数在这些库中使用的调用约定.
我在UITabBarController中的UINavigationController中有一个UIWebView.有时,UIWebView显示的页面包含HTML5视频对象.
视频按预期开始播放,但不支持横向模式.
我认为这可能是因为并非UITabBarcontroller中的所有视图控制器都自动转向横向模式(我听说过"UITabBarController中的所有视图控制器应该支持自动旋转到横向模式以使UITabBarController自动旋转").
知道任何解决方法的人吗?可能是在应用程序之外打开视频本身的一些解决方案?
谢谢!
更新2011-03-15
我会稍微改写自己,但我觉得创建一个新问题不够.我有以下层次结构:
UITabBarController
UINavigationController (NC-A)
UITableView
UIWebView (pushed from UITableView)
UINavigationController (NC-B)
A number of UITableViews
UINavigationController (NC-C)
A number of UITableViews
Run Code Online (Sandbox Code Playgroud)
我想要UIWebView(在NC-A中),它有时包含HTML5视频对象(如上所述),以支持横向模式(当用户翻转手机本身时自动旋转/ -resize)
但我不想在NC-B和NC-A控制的视图中实现自转
为了支持UITabBarController中的自动旋转,我已经读过"每个选项卡中当前'顶部'的所有视图都必须实现shoudAutorotateToInterfaceOrientation(并且对于所讨论的方向返回YES)".
有什么方法可以解决这个问题吗?
我需要有一个函数告诉我django会话ID当前是否已经过身份验证.我知道这已经内置到django中,我的工作正常.
但是我有一个传递会话ID的外部应用程序,当它将会话ID字符串传递回django时,我需要验证此会话ID是否有效并且当前已经过身份验证.
我在哪里开始重用django 1.2的一些内置函数?
谢谢
python django django-authentication django-sessions django-users
我使用Microsoft.Web.Administration.ServerManager该类来管理Windows服务中的网站.
我在我的代码中使用模拟,使用管理员用户,用户有权修改我的applicationHost.config但我在做的时候总是得到以下错误.CommitChanges();.
有一个我的代码的例子.
using (ServerManager svr = ServerManager.OpenRemote(args.IISName))
{
Site currentSite = svr.Sites.Where(item => item.Id == args.WebSite.Id).FirstOrDefault();
currentSite.Applications[0].VirtualDirectories[0].PhysicalPath = args.WebSite.PhysicalPath;
svr.CommitChanges();
}
Run Code Online (Sandbox Code Playgroud)
我找到了这个解决方案,但我的dcom属性对象是锁
您的应用程序中发生了未处理的异常.如果单击"继续",应用程序将忽略此错误并尝试继续.如果单击"退出",应用程序将立即关闭.FileName \?\ UNC [MY PATH]\applicationHost.config错误:由于权限不足,无法写入配置文件
我的设置是Windows 2008 R2,IIS 7.5,框架3.5和我的applicationHost.config在SAN上
我该怎么办?
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.UnauthorizedAccessException: Filename: \\?\[MY PATH]\applicationHost.config
Error: Cannot write configuration file due to insufficient permissions
at Microsoft.Web.Administration.Interop.IAppHostWritableAdminManager.CommitChanges()
at Microsoft.Web.Administration.ConfigurationManager.CommitChanges() …Run Code Online (Sandbox Code Playgroud) 我正在使用PHP从雅虎提取财务数据.然后我将JSON格式的数据发送到我的一个Typepad博客并使用JavaScript接收它.
在服务器端处理数据是否更快,然后将JSON子集发送到JavaScript.或者发送整个内容,然后在客户端使用JavaScript处理它会更好吗?
我如何自己学习如何进行这种权衡分析?
如何使用以下URL调用简单的servlet: http:// localhost:8080/servlet/MyServlet
我把它放在文件夹中: tomcat\webapps\ROOT\WEB-INF\classes
我读过没有必要在web.xml中提到servlet.我做了同样的事.不过,我无法调用它.
我想要做的是在我的MVC应用程序的View中显示位于我的服务器上的文件夹的内容.
我有我认为应该采取的措施,但是我有点不确定如何实施相应的视图,我想知道是否有人可以指出正确的方向.(而且,如果有人认为我的行动可以改进,欢迎提出建议:))
这是行动:
public ActionResult Index()
{
DirectoryInfo salesFTPDirectory = null;
FileInfo[] files = null;
try
{
string salesFTPPath = "E:/ftproot/sales";
salesFTPDirectory = new DirectoryInfo(salesFTPPath);
files = salesFTPDirectory.GetFiles();
}
catch (DirectoryNotFoundException exp)
{
throw new FTPSalesFileProcessingException("Could not open the ftp directory", exp);
}
catch (IOException exp)
{
throw new FTPSalesFileProcessingException("Failed to access directory", exp);
}
files = files.OrderBy(f => f.Name).ToArray();
var salesFiles = files.Where(f => f.Extension == ".xls" || f.Extension == ".xml");
return View(salesFiles);
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激,谢谢:)
我正在玩嵌入式Jetty,我想知道为什么我的过滤器只拦截/hi而不是任何其他传入的请求.这是我的示例案例:
没有过滤器:
localhost:8080/hi
=> "Hello"
localhost:8080/foo
=> 404
Run Code Online (Sandbox Code Playgroud)
使用过滤器:
localhost:8080/hi
=> "Hello from filter"
localhost:8080/foo
=> 404
Run Code Online (Sandbox Code Playgroud)
我希望最后的404返回"Hello from filter".我错过了什么?
Server server=new Server(8080);
ServletContextHandler context=
new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
context.addFilter(DispatchFilter.class,"/*",1);
context.addServlet(HelloServlet.class,"/hi");
server.setHandler(context);
server.start();
server.join();
Run Code Online (Sandbox Code Playgroud)
为了进一步澄清,我的例子只是我想要做的简化表示.我的目的是DispatchFilter拦截每一个请求.如果未满足某个条件,则应继续,否则返回从请求路径派生的内容.
也许我错过了一些东西,但我想如果我这样宣布我的课程:
public class Something<T> implements Iterable<Iterable<T>> {
public Something(Iterable<Iterable<T>> input) {
...
Run Code Online (Sandbox Code Playgroud)
我应该能够实例化它:
ArrayList<ArrayList<String>> l = new ArrayList<ArrayList<String>>();
Something<String> s = Something<String>(l);
Run Code Online (Sandbox Code Playgroud)
不幸的是,这给我一个错误.我认为ArrayLists是Iterable所以应该完全映射到我的构造函数定义.
java ×4
c# ×2
servlets ×2
.net ×1
asp.net-mvc ×1
c ×1
c++ ×1
client-side ×1
dimensions ×1
django ×1
django-users ×1
flash ×1
generics ×1
html5-video ×1
iis ×1
iphone ×1
iterator ×1
javascript ×1
jetty ×1
php ×1
python ×1
security ×1
server-side ×1
size ×1
tomcat ×1
uiwebview ×1
view ×1
visual-c++ ×1