我有一个我在通知中使用的自定义mp3声音.它适用于API 26以下的所有设备.我也尝试在Notification Channel上设置声音,但仍无法正常工作.它播放默认声音.
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, channelId)
.setAutoCancel(true)
.setSmallIcon(R.drawable.icon_push)
.setColor(ContextCompat.getColor(this, R.color.green))
.setContentTitle(title)
.setSound(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.notification))
.setDefaults(Notification.DEFAULT_VIBRATE)
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
.setContentText(message);
Notification notification = builder.build();
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_DEFAULT);
AudioAttributes audioAttributes = new AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE)
.build();
channel.setSound(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.notification), audioAttributes);
notificationManager.createNotificationChannel(channel);
}
notificationManager.notify(1, notification);
Run Code Online (Sandbox Code Playgroud) 抱歉我的英语不好,但我想这不会有问题.我只是想分享一个很好的Helper类,我使用Microsoft Ajax Minifier对我们的脚本和样式进行组合,缩小和gzip.在开始之前,请下载ICSharpCode.SharpZipLib.这是一个使用gzip的开源库.
让我们从web.config开始(我将专注于IIS7).在这里,我们向我们的应用程序说,对cssh或jsh扩展所做的任何请求都将被转发到MinifierHelper类.我选择使用这些扩展(cssh和jsh),如果我们想要,不管出于什么原因,不要缩小特定的脚本或样式,按照你正常使用的方式使用它.
<system.webServer>
<handlers>
<remove name="ScriptHandler" />
<remove name="StyleHandler" />
<add name="ScriptHandler" verb="*" path="*.jsh" type="Site.Helpers.MinifierHelper" resourceType="Unspecified" />
<add name="StyleHandler" verb="*" path="*.cssh" type="Site.Helpers.MinifierHelper" resourceType="Unspecified" />
</handlers>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
我使用文件夹脚本和样式来存储文件.我不使用Visual Studio建议的文件夹内容.
下一步是配置global.asax.我们必须告诉我们的应用程序不要路由这些文件夹.将这些行添加到RegisterRoutes方法中.
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("Scripts/{*path}");
routes.IgnoreRoute("Styles/{*path}");
...
}
Run Code Online (Sandbox Code Playgroud)
好.现在我将展示如何使用我们的课程.在视图中:
<link href="/Styles/Folder/File.cssh" type="text/css" rel="stylesheet" />
<script src="/Scripts/Folder/File.jsh" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
在我的示例中,我将所有脚本和样式的逻辑设置为脚本/样式中的文件夹内部.例如:站点 - >脚本 …
在这种情况下,有没有办法显示X轴的所有日子?即使我强迫minTickInterval到一天高图不显示所有的日子.
$(function () {
$('#container').highcharts({
chart: {type: "column", inverted: true,
},
xAxis: {
type: 'datetime'
},
plotOptions: {
series: {
pointInterval: 24 * 3600 * 1000,
pointRange: 24 * 3600 * 1000
}
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}, {
data: [144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2]
}]
});
Run Code Online (Sandbox Code Playgroud)
});
有没有更好的方法来检查对象是否为空?我正在使用这个:
function isObjEmpty(obj)
{
for (var p in obj) return false;
return true;
}
Run Code Online (Sandbox Code Playgroud) 假设我有一个名为User的表.当我使用实体框架来获取记录时,我喜欢这样:
var db = new Context();
var users = db.Users;
Run Code Online (Sandbox Code Playgroud)
它返回我表中的所有用户.好.如果我这样做:
var fooUsers = db.Users.Where(u => u.Name == 'foo');
Run Code Online (Sandbox Code Playgroud)
它会给我所有名为'foo'的用户.好.我的问题是:实体框架进行如下查询:
select * from user where name = 'foo'
Run Code Online (Sandbox Code Playgroud)
或者它加载所有用户并使用lambda表达式在服务器上过滤它们?
之间有什么区别:
public ActionResult logOff()
{
FormsAuth.SignOut();
return RedirectToAction("index", "Home");
}
Run Code Online (Sandbox Code Playgroud)
和:
public ActionResult logOff()
{
FormsAuth.SignOut();
return index();
}
Run Code Online (Sandbox Code Playgroud) 我只想调整我的方法来传输我在浏览器接受gzip时压缩的数据.该else部分已经有效.我只是想调整if部分.下面是代码:
private void writeBytes()
{
var response = this.context.Response;
if (canGzip)
{
response.AppendHeader("Content-Encoding", "gzip");
//COMPRESS WITH GZipStream
}
else
{
response.AppendHeader("Content-Length", this.responseBytes.Length.ToString());
response.ContentType = this.isScript ? "text/javascript" : "text/css";
response.AppendHeader("Content-Encoding", "utf-8");
response.ContentEncoding = Encoding.Unicode;
response.OutputStream.Write(this.responseBytes, 0, this.responseBytes.Length);
response.Flush();
}
}
Run Code Online (Sandbox Code Playgroud) 我在微软论坛上看到我可以创建.tfignore文件并将其放在根文件夹中.我有一个名为的文件夹Libs,它包含我想要保持在源代码管理下的DLL文件.如何使用.tfignore文件将我的Libs文件夹包含在源coutrol中?
asp.net ×3
c# ×2
gzip ×2
android ×1
asp.net-mvc ×1
caching ×1
highcharts ×1
javascript ×1
json ×1
lambda ×1
minify ×1
tfs ×1