我正在使用WCF4.0模板 - REST.我正在尝试创建一个使用流上传文件的方法.
问题总是发生在
Stream serverStream = request.GetRequestStream();
Run Code Online (Sandbox Code Playgroud)
流媒体类:
namespace LogicClass
{
public class StreamClass : IStreamClass
{
public bool UploadFile(string filename, Stream fileStream)
{
try
{
FileStream fileToupload = new FileStream(filename, FileMode.Create);
byte[] bytearray = new byte[10000];
int bytesRead, totalBytesRead = 0;
do
{
bytesRead = fileStream.Read(bytearray, 0, bytearray.Length);
totalBytesRead += bytesRead;
} while (bytesRead > 0);
fileToupload.Write(bytearray, 0, bytearray.Length);
fileToupload.Close();
fileToupload.Dispose();
}
catch (Exception ex) { throw new Exception(ex.Message); }
return true;
}
}
}
Run Code Online (Sandbox Code Playgroud)
REST项目:
[WebInvoke(UriTemplate …
Run Code Online (Sandbox Code Playgroud) 我必须列出要分配给" 员工 "的所有" 班次 "数据,但如果员工数据中已存在班次数据,则不得包括班次数据.我们来看看图片样本.
此查询解决了该问题.我在这里找到了这个:
Scott的博客
select * from shift where not exists
(select 1 from employeeshift where shift.shiftid = employeeshift.shiftid
and employeeshift.empid = 57);
Run Code Online (Sandbox Code Playgroud)
让我们看看结果:
现在我的问题是,我怎么能在linQ中做到这一点?我正在使用实体框架.
希望有人能提供帮助.非常感谢!!!
我已经通过几个网站建议解决这个问题,但我仍然无法摆脱它.
我的WebConfig:
<bindings>
<webHttpBinding>
<binding name="SecureBasicRest">
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="svcBehavior">
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="svcEndpoint">
<webHttp helpEnabled="true"/>
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="SvcContract.Authenticate" behaviorConfiguration="svcBehavior">
<endpoint binding="webHttpBinding" bindingConfiguration="SecureBasicRest"
behaviorConfiguration="svcEndpoint" name="webHttp"
contract="SvcContract.Authenticate" />
</service>
</services>
Run Code Online (Sandbox Code Playgroud)
希望有人能提供帮助.提前致谢!.
编辑
我必须使用
https:// localhost:6188/Authenticate/Login?username = user&password = pass&ip = 127.0.0.1
我发现很难理解UTC是如何工作的.
我必须做以下事情,但如果我得到了正确的结果,我仍然感到困惑.
目标:
所以代码是:
public ConvertDate(DateTime? dateTime)
{
if (dateTime != null)
{
Value = (DateTime)dateTime;
TimeZone = GetFromConfig.DefaultTimeZone();
}
}
public ConvertDate(DateTime? dateTime, int GMTTimeZone)
{
if (dateTime != null)
{
Value = (DateTime)dateTime;
TimeZone = GMTTimeZone;
}
}
public int TimeZone
{
get { return m_TimeZone; }
set { m_TimeZone = value; }
}
DateTime m_Value;
public DateTime Value
{
get { return m_Value; }
set
{
m_Value = value;
DateTime converted = m_Value.ToUniversalTime().ToLocalTime();
} …
Run Code Online (Sandbox Code Playgroud) 如何将此设置转换为命令?
结果如下:
// Manual Compression (see the image above)
Compressed Size: 12,647,451 bytes
// Ultra
7z a -t7z Files.7z -mx9 -aoa
Compressed Size: 12,676,886 bytes
// LZMA2
7z a -t7z Files.7z -m9=LZMA2 -aoa
Compressed Size: 14,237,515 bytes
Run Code Online (Sandbox Code Playgroud)
我在这里看:http:
//sevenzip.sourceforge.jp/chm/cmdline/switches/method.htm
我将把它放在一个批处理文件中.
我试过这些
WCF服务URI模板中的可选参数?Kamal Rawat在博客中发表| 2012年9月4日的.NET 4.5本节介绍如何在WCF Servuce URI inShare中传递可选参数
和
但没有什么对我有用.这是我的代码:
[WebGet(UriTemplate = "RetrieveUserInformation/{hash}/{app}")]
public string RetrieveUserInformation(string hash, string app)
{
}
Run Code Online (Sandbox Code Playgroud)
如果填充参数,它可以工作:
https://127.0.0.1/Case/Rest/Qr/RetrieveUserInformation/djJUd9879Hf8df/Apple
Run Code Online (Sandbox Code Playgroud)
但如果app
没有价值 就行不通
https://127.0.0.1/Case/Rest/Qr/RetrieveUserInformation/djJUd9879Hf8df
Run Code Online (Sandbox Code Playgroud)
我想做app
可选的.怎么做到这一点?
这是app
没有值时的错误:
Endpoint not found. Please see the service help page for constructing valid requests to the service.
Run Code Online (Sandbox Code Playgroud) 我试图将testdabse.invoice
表的数据复制到basecampdev.invoice
表.
testdabse
是basecampdev
在服务器中的本地数据库.
它说,我将数据复制到另一个表的查询不起作用
Invalid object name 'basecampdev.dbo.invoice'.
Run Code Online (Sandbox Code Playgroud)
我一直在阅读这个文档,但发现很难理解和理解.
这些是从服务器给出的信息
Server type: Database Engine
Server name: server.database.windows.net (this is not the real name)
Authentication: SQL Server Authentication
Login: myusername
Password: mypassword
Run Code Online (Sandbox Code Playgroud)
如何连接到服务器以便我能够运行此查询
INSERT INTO [basecampdev].[dbo].[invoice]
([InvoiceNumber]
,[TotalAmount]
,[IsActive]
,[CreatedBy]
,[UpdatedBy]
,[CreatedDate]
,[UpdatedDate]
,[Remarks])
SELECT [InvoiceNumber]
,[TotalAmount]
,[IsActive]
,[CreatedBy]
,[UpdatedBy]
,[CreatedDate]
,[UpdatedDate]
,[Remarks] FROM [testdabse].[dbo].[invoice]
Run Code Online (Sandbox Code Playgroud)
屏幕截图
我已经成功地遵循了这个主题
Phonegap 3.0.0:BarcodeScanner Plugin
但它似乎无法扫描Qr代码.这是从手机拍摄的屏幕:
我试过扫描条形码图像,它工作正常.但不是QR图像.
任何的想法?
编辑
var scanner = cordova.require("com.phonegap.plugins.barcodescanner.barcodescanner");
scanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);
Run Code Online (Sandbox Code Playgroud)
编辑2
DuuhhH !!! 问题是QR图像,它没有边际,肖恩欧文说.
在执行这些任务时,最好的,安全的,100%免费的工具是什么?它被问过很多次,但我想问那些有经验的用户.
我正在寻找一个简短的代码,可以将逗号放入一组数字,直到我来到这个网站.
代码:
function addCommas(nStr)
{
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
Run Code Online (Sandbox Code Playgroud)
工作真的很棒.有这个例子的数字集:
addCommas('83475934.89');
Run Code Online (Sandbox Code Playgroud)
将返回"83,475,934.89"
,但当我阅读代码时,我希望它返回,8,3,4,7,5,934.89
但这个网站解释了这一点
\d+
结合使用\d{3}
将匹配一组3个数字,前面跟着任意数量的数字.这使得搜索从右到左替换.
我很困惑.这段代码如何从右到左阅读?另外,是什么$1
和$2
意味着什么呢?
c# ×5
rest ×3
wcf ×3
javascript ×2
sql ×2
7zip ×1
batch-file ×1
command-line ×1
compression ×1
cordova ×1
css ×1
datetime ×1
https ×1
linq ×1
minify ×1
openrowset ×1
qr-code ×1
regex ×1
sql-server ×1
utc ×1
web-config ×1