我一直在寻找一些时间,找不到Turn.js的好选择.Turn.js似乎很好,但我想在花钱之前先看一些替代方案.如果有开源替代方案会更好.
我正在寻找的主要功能是:
在我们的应用程序中,我想使用Android v4.2或更高版本连接到之前配对的A2DP蓝牙扬声器并直接播放音频.
我可以使用此代码成功创建A2DP配置文件对象以启动该过程:
/* Manifest permissions */
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
Run Code Online (Sandbox Code Playgroud)
// Get the default adapter
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
// Establish connection to the proxy.
mBluetoothAdapter.getProfileProxy(this, mProfileListener, BluetoothProfile.A2DP)
Run Code Online (Sandbox Code Playgroud)
并且以下监听器响应连接:
private BluetoothProfile.ServiceListener mProfileListener = new BluetoothProfile.ServiceListener() {
public void onServiceConnected(int profile, BluetoothProfile proxy) {
if (profile == BluetoothProfile.A2DP) {
mBluetoothSpeaker = (BluetoothA2dp) proxy;
// no devices are connected
List<BluetoothDevice> connectedDevices = mBluetoothSpeaker.getConnectedDevices();
//the one paired (and disconnected) speaker is returned here
int[] statesToCheck = {BluetoothA2dp.STATE_DISCONNECTED};
List<BluetoothDevice> disconnectedDevices = mBluetoothSpeaker.getDevicesMatchingConnectionStates(statesToCheck);
BluetoothDevice …
Run Code Online (Sandbox Code Playgroud) 在我的代码中,我倾向于使用许多Flags枚举,这些枚举对应于包含其所有行为属性的DB表.这样,行为属性既可以在SP中使用,也可以在使用枚举的C#代码中使用.
我的问题是Enums附加了Flags属性.
有没有办法自动生成2的幂作为此类表的标识列(或序列)?
PS:目前我手动将代码放在小表中 - 或者以编程方式放在随时间变化的表中 - 我更喜欢自动进行
我有一个大的SQL脚本(1gb),我试图在一个(localdb)\v11.0
实例上运行,SqlCmd
在命令行窗口中使用,但到目前为止,我尝试过的任何命令都没有使用它.
例如
sqlcmd.exe -S "(localdb)\v11.0" -Q "select 1"
Run Code Online (Sandbox Code Playgroud)
失败并出现通用连接错误:
建立与SQL Server的连接时发生了与网络相关或特定于实例的错误.找不到服务器或无法访问服务器.检查实例名称是否正确以及SQL Server是否配置为允许远程连接.
然而
sqlcmd.exe -S "MY-PC" -Q "select 1"
Run Code Online (Sandbox Code Playgroud)
我的电脑上的SQL Server实例很好用.
在(localdb)
实例上"允许远程连接"设置为true,而我运行的用户sqlcmd
是它的所有者.
Sqlcmd
实际上是否适用于(localdb)
实例?还有其他明显的事情我可能做错了吗?
我已经设置了一个愉快的 Azure DevOps 构建管道,该管道在提交到分支时触发,然后恢复 Nuget 包,构建我的 Mvc.Core Web 应用程序并将其部署到 Azure 应用服务。
但是,LibMan 中引用的 JS 库不会恢复并部署到 Azure。我怎样才能做到这一点?
我已经包含了 LibMan 构建包(我读到它会自动执行任务),但没有任何乐趣。
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.0.96" />
Run Code Online (Sandbox Code Playgroud)
我是否真的需要向管道添加 .net core 自定义命令来安装 LibraryManager Cli 工具,然后调用它来恢复 JS 库?这似乎比我想象的更复杂,而且我没有找到任何人在网上这样做的例子。
另一种方法是将 JS 库包含在源代码管理中吗?如果可能的话,我确实想避免这种情况,但如果这是标准方法,那么我想我很乐意这样做。
任何有关在 Azure DevOps 中实现此目标的建议或 YAML 示例,我们将不胜感激。
tl;dr 如何从 .net Core 3.1 Windows 服务打印 pdf?
我创建了一个简单的打印后台处理程序类,它作为Windows ServiceBackgroundService
运行,并通过 Web API 监视打印队列,一切都非常愉快。
我在开始编写实际打印代码时发现的一个小问题是,.net core 似乎不希望人们从BackgroundService
类中打印文档。
无论如何, System.Printing的文档似乎都建议这样做。
不支持在 Windows 服务或 ASP.NET 应用程序或服务中使用 System.Printing 命名空间中的类。尝试在这些应用程序类型之一中使用这些类可能会产生意外的问题,例如服务性能下降和运行时异常。
System.Drawing.Printing在其文档中有类似的注释,指出它也不能可靠地用于 Windows 服务。
从BackgroundService
Windows 服务打印是一件坏事吗 (tm)?我的(简短的)谷歌搜索未能找到System.Printing
/的明显替代品吗?System.Drawing.Printing
打印要求应该非常简单,我有 pdf 字节数组数据,我只需要以某种方式到达打印机)。
我意识到我可以做一些事情,比如将假脱机程序转换为控制台应用程序,并从计划任务运行它,但 Windows 服务模型似乎更简单,只需安装并忘记(它注定用于打印机旁边的 PC在仓库里)
任何有用的建议将不胜感激
我的iPhone应用程序中有一个简单的屏幕,我希望在屏幕底部有一个320x100的矩形来捕捉触摸.这是我的代码touchesBegan:withEvent
:
for (UITouch *touch in touches) {
CGPoint touchPoint = [touch locationInView:self.view];
NSLog(@"touch @ %f, %f", touchPoint.x, touchPoint.y);
// build a rectangle where we want to capture a URL tap
CGRect rectangle = CGRectMake(0, 480, 320, 100);
NSLog(@"midX, midY = %f, %f", CGRectGetMidX(rectangle), CGRectGetMidY(rectangle));
// check to see if they tapped the URL
if (CGRectContainsPoint(rectangle, touchPoint)) {
NSLog(@"You touched inside the rectangle.");
}
}
Run Code Online (Sandbox Code Playgroud)
现在这段代码无法正常工作......从矩形中点开始的日志显示我的矩形是在内置的midX, midY = 160.000000, 530.000000
.根据CGPoint文档,原点(0, 480)
是左下角,但这就像原点是左上角.
当我将矩形的原点更改为0,380时,一切都按预期工作.也许我今天早上没有适当的咖啡因,但为什么我看到文档和执行之间的这种差异?
我们已经创建了一个VSTO 2010项目,其中包含一个用于Excel的功能区,它可以很好地运行,但现在我们的一些客户将会运行Office 2007.
我们已经尝试在2007年安装它,没有运气(功能区被列为正在运行的插件,但它不会出现在Excel的功能区选项卡中).我已经尝试按照这个SO问题中提到的步骤(用2007参考dll替换2010参考dll),但没有成功.
任何建议,以避免必须创建一个新的2007项目(据我所知,将涉及在我们的开发机器上卸载Office 2010,而不是安装2007)将非常感谢.
谢谢!
我正在使用Apatana 3,我稍微修改了JS代码格式化程序,让它看起来更清晰,下面是格式化后的代码,它给我一个错误:
copyOffset : function( index )
{
return
{
x : index, y : index
};
}
Run Code Online (Sandbox Code Playgroud)
萤火虫给我:
SyntaxError: invalid label
Run Code Online (Sandbox Code Playgroud)
如果我改为:
copyOffset : function( index )
{
return{
x : index, y : index
};
}
Run Code Online (Sandbox Code Playgroud)
没问题,谁能告诉我这两个回报声明之间的区别是什么?
我们很晚才将成功的 .net Core 2.1 MVC 应用程序升级到 .net Core 5,除了一些Microsoft.Data.SqlClient.SqlException 'Execution Timeout Expired'
曾经在 EF Core 2.1 中运行良好的查询中出现一些令人困惑的异常之外,一切都进展顺利。
这是我们遇到问题的查询之一的示例
var products = await _context.ShopProducts
.Include(p => p.Category)
.Include(p => p.Brand)
.Include(p => p.CreatedBy)
.Include(p => p.LastUpdatedBy)
.Include(p => p.Variants).ThenInclude(pv => pv.ProductVariantAttributes)
.Include(p => p.Variants).ThenInclude(pv => pv.CountryOfOrigin)
.Include(p => p.Page)
.Include(p => p.CountryOfOrigin)
.OrderBy(p => p.Name)
.Where(p =>
(string.IsNullOrEmpty(searchText)
|| (
p.Name.Contains(searchText)
|| p.Description.Contains(searchText)
|| p.Variants.Any(v => v.SKU.Contains(searchText))
|| p.Variants.Any(v => v.GTIN.Contains(searchText))
|| p.Brand.BrandName.Contains(searchText)
|| p.CountryOfOriginCode == searchText
|| p.Category.Breadcrumb.Contains(searchText)
) …
Run Code Online (Sandbox Code Playgroud) entity-framework entity-framework-core asp.net-core-mvc ef-core-2.2 ef-core-3.1
我正在尝试使用Microsoft.Exchange.WebServices 托管 API和基于此 FindFolder() 示例的代码来枚举 Exchange 帐户中的仅电子邮件文件夹。
以下代码过滤所有空文件夹、 、Task
、Search
和文件夹Contacts
,Calendar
但仍返回FreeBusy Data
、Recoverable Items
和Deletions
文件夹。
有没有办法可以从返回的文件夹中过滤这些内容,而不是通过名称上的字符串匹配来过滤这些内容?事实上,还有一种过滤方式Sent Items
吗Deleted Items
?(虽然这些不能被重命名(而且我对它们是什么有更好的了解!),但我不太担心简单地按名称过滤掉它们)
Dim moreFoldersToReturn As Boolean = True
Const FOLDER_PAGE_SIZE As Integer = 10
Dim folderOffset As Integer = 0
While moreFoldersToReturn
' Create a view with a page size of x
Dim view As New FolderView(FOLDER_PAGE_SIZE, folderOffset)
' Identify the properties to return …
Run Code Online (Sandbox Code Playgroud) 我想将appsettings
本地 web.config 文件的部分从本地开发工作的一堆单独设置转换为configSource
用于发布到客户端服务器的文件路径属性。
基本上是这样的:
<appSettings>
<add key="setting1" value="devVal1"></add>
<add key="setting2" value="devVal2"></add>
<add key="setting3" value="devVal3"></add>
</appSettings>
Run Code Online (Sandbox Code Playgroud)
对此:
<appSettings configSource="clientSettings.config" />
Run Code Online (Sandbox Code Playgroud)
此部分解决方案添加了 configSource 属性。
<appSettings xdt:Transform="SetAttributes(configSource)" configSource="clientSettings.config"/>
Run Code Online (Sandbox Code Playgroud)
但我不确定如何删除所有单独的设置(我认为 configSource 无论如何都会覆盖它们,但我宁愿根本不存在它们,以避免在我的每个客户的网络中都有不相关的开发设置.config 文件)
具有讽刺意味的是,在将一堆旧的Arraylists转换为使用通用List(Of foo)集合时,为了提高类型安全性,我在List.AddRange()
方法中遇到了意外行为.
鉴于以下代码,我本来期望编译器错误,但我没有得到一个,并且项目运行直到AddRange调用,其中'无法将List(Of bar)转换为List(Of foo)'异常是抛出.
Dim barList As List(Of bar) = BarFunctionsLib.GetBarList()
Dim fooList As New List(Of foo)
fooList.AddRange(barList)
Run Code Online (Sandbox Code Playgroud)
我不应该尝试将List(Of bar)传递给List(Of foo)上的AddRange方法吗?我没有通过我在VS2015中的编译器设置,也许他们过去已经摆弄过,现在让它通过?
任何想法都将受到赞赏,因为将工作转换为将Arraylists转换为通用列表的整个理由是为了防止这样的错误.
c# ×3
.net-core ×2
javascript ×2
sql-server ×2
.net ×1
a2dp ×1
android ×1
aptana3 ×1
asp.net ×1
azure ×1
azure-devops ×1
bluetooth ×1
ef-core-2.2 ×1
ef-core-3.1 ×1
excel-2007 ×1
excel-2010 ×1
flash ×1
generics ×1
html5 ×1
iphone ×1
java ×1
libman ×1
localdb ×1
objective-c ×1
pdf ×1
printing ×1
sqlcmd ×1
vb.net ×1
vsto ×1
web-config ×1
xslt ×1