我正在尝试将视频文件从ASP.NET MVC提供给iPhone客户端.视频格式正确,如果我在一个可公开访问的网络目录中,它可以正常工作.
我所读到的核心问题是,iPhone要求您拥有一个可随时使用的简历下载环境,该环境允许您通过HTTP标头过滤字节范围.我认为这是为了让用户可以跳过视频.
使用MVC提供文件时,这些标头不存在.我试图模仿它,但没有运气.我们这里有IIS6,我根本无法做很多标题操作.ASP.NET将我抱怨说:" 此操作需要IIS综合管道模式. "
升级不是一种选择,我不允许将文件移动到公共Web共享.我觉得受到环境的限制,但我仍在寻找解决方案.
以下是我正在尝试做的一些示例代码...
public ActionResult Mobile(string guid = "x")
{
guid = Path.GetFileNameWithoutExtension(guid);
apMedia media = DB.apMedia_GetMediaByFilename(guid);
string mediaPath = Path.Combine(Transcode.Swap_MobileDirectory, guid + ".m4v");
if (!Directory.Exists(Transcode.Swap_MobileDirectory)) //Make sure it's there...
Directory.CreateDirectory(Transcode.Swap_MobileDirectory);
if(System.IO.File.Exists(mediaPath))
return base.File(mediaPath, "video/x-m4v");
return Redirect("~/Error/404");
}
Run Code Online (Sandbox Code Playgroud)
我知道我需要做这样的事情,但是我无法在.NET MVC中做到这一点.http://dotnetslackers.com/articles/aspnet/Range-Specific-Requests-in-ASP-NET.aspx
以下是一个有效的HTTP响应标头示例:
Date Mon, 08 Nov 2010 17:02:38 GMT
Server Apache
Last-Modified Mon, 08 Nov 2010 17:02:13 GMT
Etag "14e78b2-295eff-4cd82d15"
Accept-Ranges bytes
Content-Length 2711295
Content-Range bytes 0-2711294/2711295
Keep-Alive timeout=15, max=100
Connection Keep-Alive
Content-Type text/plain
Run Code Online (Sandbox Code Playgroud)
这是一个没有的例子(这是来自.NET) …
据我所知,PhoneGap应用程序主要(如果不是全部)HTML5 + CSS + JavaScript.本地,iPhone不提供上传文件的控件.
PhoneGap是否提供允许用户上传文件的任何机制?(图像/视频,在iPhone的情况下)
我知道Titanium允许用户这样做,但它与编译的Javascript和专有API是不同的动物.感谢您的建议/意见.
我注意到在ASP.NET MVC 2,该模型粘结剂将无法识别"1"和"0" true和false分别.是否可以全局扩展模型绑定器以识别它们并将它们转换为适当的布尔值?
谢谢!
我在我的计算机上有一个本地Git存储库,我试图用Hg-Git克隆.当我从git://类型路径克隆时,它对我来说很好,但如果我尝试从本地目录克隆则不行.
这是一个例子......
hg clone "C:\Users\James\Documents\My Games\FalloutNV"
destination directory: FalloutNV
importing Hg objects into Git
abort: The system cannot find the file specified
Run Code Online (Sandbox Code Playgroud)
路径确实存在,并且它以某种方式知道它是一个Git仓库,但它有向后的方向.它应该将Git对象导入(新)Hg仓库.
有任何想法吗?我在Windows上,尝试使用TortoiseHg但在命令行中足够舒服.
今晚我发现如果我重命名FalloutNV为FalloutNV.git......克隆将从本地磁盘神奇地工作.只是一个可能有帮助的指针!
我在将表格加载到设计器中时遇到了一些问题.我收到以下错误.
一个或多个所选项目包含设计者不支持的数据类型
假设它是表中使用的导致此错误的地理类型,我是否正确?
任何指针都非常赞赏.
我正在尝试使用MongoDB,C#和NoRM来处理一些示例项目,但是在这一点上,我在围绕数据模型时遇到了困难.使用RDBMS的相关数据是没有问题的.然而,在MongoDB中,我很难决定如何处理它们.
让我们以StackOverflow为例......我可以理解问题页面上的大部分数据都应该包含在一个文档中.标题,问题文本,修订,评论......在一个文档对象中都很好.
我开始变得模糊的问题是用户数据,例如用户名,头像,声誉(特别经常变化)...每次用户更改时,您是否会对数千个文档记录进行非规范化更新或以某种方式链接数据在一起?
在不导致每次页面加载时发生大量查询的情况下,实现用户关系的最有效方法是什么?我注意到DbReference<T>NoRM中的类型,但还没有找到一种很好的方法来使用它.如果我有可空的可选关系怎么办?
感谢您的见解!
Rust是否有办法"关闭"一个频道,类似于Go中提供的频道?
我们的想法是迭代通道(连续接收),直到通道指示它不再产生任何值.
use std::sync::{Arc, Mutex};
use std::thread;
use std::sync::mpsc;
fn main() {
let data = Arc::new(Mutex::new(0u32));
let (tx, rx) = mpsc::channel::<u32>();
{
let (data, tx) = (data.clone(), tx.clone());
thread::spawn(move || {
for _ in 0..10 {
let mut data = data.lock().unwrap();
*data += 1;
tx.send(*data).unwrap();
}
// *** How could I close the channel here, to signal the work is done?
});
}
// *** How can I detect a closed channel here? Pattern matching?
for _ in …Run Code Online (Sandbox Code Playgroud) 我有一个加载在动态外部KML中的地图,其地标定义如下:
<Placemark id="MapZoneID_23443">
<name>Name Here</name>
<description>Text Here</description>
<styleUrl>#ff8080ff</styleUrl>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
....
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
Run Code Online (Sandbox Code Playgroud)
我想做的是有一个链接/下拉/任何可以点击或选择的基本上触发点击$('#MapZoneID_23443')...但我无法弄清楚如何触发该点击或甚至可能.地图可能非常复杂,所以我宁愿不必使用JS gmaps标记预加载所有内容.谢谢!
我在这里有一个愚蠢的例子,只是为了演示我遇到的另一个库和模式匹配的问题.
struct Person {
name: String,
age: i32,
choice: Choices
}
#[derive(Debug)]
enum Choices {
Good,
Neutral,
Evil
}
fn find(p: Person) {
match (p.choice, p.age) {
(Choices::Good, a) if a < 80 => {
announce(p);
}
(_, a) if a >= 80 => {
println!("You're too old to care.");
}
_ => {
println!("You're not very nice!")
}
}
}
fn announce(p: Person) {
println!("Your name is {}. You are {:?}.", p.name, p.choice);
}
fn main() {
let p …Run Code Online (Sandbox Code Playgroud) 我想创建一个基本特征,将实现其他运营商的特征(Add,Subtract,Multiply,Divide,等...)我.
这无法编译,它看起来像一个发布Sized,但即使Measurement设置为要求Sized它不起作用.这甚至可能吗?
use std::ops::Add;
#[derive(Copy, Clone, Debug)]
struct Unit {
value: f64,
}
impl Unit {
fn new(value: f64) -> Unit {
Unit { value: value }
}
}
trait Measurement: Sized {
fn get_value(&self) -> f64;
fn from_value(value: f64) -> Self;
}
impl Measurement for Unit {
fn get_value(&self) -> f64 {
self.value
}
fn from_value(value: f64) -> Self {
Unit::new(value)
}
}
// This …Run Code Online (Sandbox Code Playgroud) rust ×3
c# ×2
iphone ×2
asp.net-mvc ×1
channel ×1
cordova ×1
file-upload ×1
git ×1
google-maps ×1
hg-git ×1
javascript ×1
kml ×1
linq-to-sql ×1
mercurial ×1
mongodb ×1
move ×1
norm ×1
sqlgeography ×1
traits ×1