我有一个ogg vorbis文件,我必须用它做两个操作:
如何在C#中实现这两个操作?
这是JSfiddle:http://jsfiddle.net/buyC9/128/
我想清除时只清除文件上传字段.
我的HTML:
<h1>Upload image:</h1>
<input type="file" name="blog[opload]" id="blog_opload" class="imagec">
<input type="url" size="50" name="blog[url]" id="blog_url" class="imagec">
<div id="preview">
</div>
Run Code Online (Sandbox Code Playgroud)
我的Jquery:
$('input').change(function() {
var el = $(this);
if (this.value === "") {
$('.imagec').prop('disabled', false);
this.disabled = false;
$('#preview').hide();
} else {
$('.imagec').prop('disabled', true);
el.prop('disabled', false);
alert(el.val());
if (el.attr('type') == 'url') {
$('#preview').show().html('<img src=' + '"' + el.val() + '"' + ' />');
}
}
});
function reset_html(id) {
$('.' + id).html( $('.' + id).html() );
}
var imagec_index …Run Code Online (Sandbox Code Playgroud) 这段代码为名为的事件添加了新的EventHandler寄存器NewMail(eventargs类被命名NewMailEventArgs.
// A PUBLIC add_xxx method (xxx is the event name)
// Allows methods to register interest in the event.
public void add_NewMail(EventHandler<NewMailEventArgs> value) {
// The loop and the call to CompareExchange is all just a fancy way
// of adding a delegate to the event in a thread-safe way.
EventHandler<NewMailEventArgs> prevHandler;
EventHandler<NewMailEventArgs> newMail = this.NewMail;
do {
prevHandler = newMail;
EventHandler<NewMailEventArgs> newHandler = (EventHandler<NewMailEventArgs>)Delegate.Combine(prevHandler, value);
newMail = Interlocked.CompareExchange<EventHandler<NewMailEventArgs>>(ref this.NewMail, newHandler, prevHandler);
}
while(newMail != …Run Code Online (Sandbox Code Playgroud) 我们有一个包含国家名称的列表.我们需要从列表b/w两个字母中找到国家/地区的名称.类似名称以b/w AG开头的所有国家/地区的名称等.我们创建以下linq查询,但它的丑陋.
var countryAG = from elements in countryList
where elements.StartsWith("A") ||
elements.StartsWith("B") ||
elements.StartsWith("C") ||
elements.StartsWith("D") ||
elements.StartsWith("E") ||
elements.StartsWith("F") ||
elements.StartsWith("G") ||
elements.StartsWith("H")
select elements;
Run Code Online (Sandbox Code Playgroud)
其中countryList是在C#中创建的
List< string> countryList = new List< string>();
Run Code Online (Sandbox Code Playgroud)
完成上述任务的任何帮助或任何其他有效方法?
从电子邮件中的链接单击时,以下代码会导致在浏览器中打开PDF文档:
Response.ContentType = mime;
Response.WriteFile(path);
HttpContext.Current.ApplicationInstance.CompleteRequest();
Run Code Online (Sandbox Code Playgroud)
有没有办法迫使客户在Adobe Acrobat/reader中原生地打开它?
我刚开始使用c#和asp.net在visual studio开发Web应用程序.在我的一个页面中,我将文本框的文本值设置为某个值.用户可以更改文本并保存.单击保存按钮,我必须从文本框中获取新的文本值,但我总是得到第一个文本集.如果你帮助我,我会很高兴的.
在我的应用程序中,我想看看Windows 7是否被激活.要清楚,我不想检查窗户是否是正品.我使用下面的代码,在这里找到http://www.dreamincode.net/forums/topic/166690-wmi-softwarelicensingproduct/
执行查询所需的时间约为5-10秒.反正有没有减少所需的时间?或者另一种检查winows 7是否被激活的方法?
public string VistaOrNewerStatus(){
string status = string.Empty;
string computer = ".";
try
{
//set the scope of this search
ManagementScope scope = new ManagementScope(@"\\" + computer + @"\root\cimv2");
//connect to the machine
scope.Connect();
//use a SelectQuery to tell what we're searching in
SelectQuery searchQuery = new SelectQuery("SELECT * FROM SoftwareLicensingProduct");
//set the search up
ManagementObjectSearcher searcherObj = new ManagementObjectSearcher(scope, searchQuery);
//get the results into a collection
using (ManagementObjectCollection obj = searcherObj.Get())
{
MessageBox.Show(obj.Count.ToString());
//now loop …Run Code Online (Sandbox Code Playgroud) 我需要没有utcOffset的往返格式的DateTime.Now值.基于这篇MSDN文章,如果你创建一个没有UtcOffset的DateTime的新实例,它会产生我想要的格式.
DateTime date1 = new DateTime(2008, 4, 10, 6, 30, 0);
// Displays 2008-04-10T06:30:00.0000000
Run Code Online (Sandbox Code Playgroud)
但如果我使用DateTime.Now,我得到字符串中的偏移量:
DateTime.Now.ToString("o")
// Displays 2012-02-08T14:11:12.8378703-05:00
Run Code Online (Sandbox Code Playgroud)
我可以使用substring或填充没有它的DateTime实例,但我想知道是否有办法删除UtcOffset.
好的,我正在尝试使用Interop连接到C#中的共享Outlook日历并添加新的会议请求.
这是我到目前为止所做的,从我的using语句开始(这是一个Windows窗体):
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Windows.Forms;
using Outlook = Microsoft.Office.Interop.Outlook;
Run Code Online (Sandbox Code Playgroud)
然后我有一个叫做"约会"的公共课,如下:
public class Appointments
{
public string ConversationTopic { get; set; }
public int Duration { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public string Organizer { get; set; }
public int ReminderMinutesBeforeStart { get; set; }
public string RequiredAttendees { get; set; }
public string Subject { get; set; }
public string Body …Run Code Online (Sandbox Code Playgroud)