我在使用localhost时如何启用浏览器通知,在控制台Notification.requestPermission();
中写入时没有任何内容,但在任何常规站点上写入控制台if($count['total_runs'] == null || $count['total_runs'] == 0) {
continue;
}
时,请求权限。
如何启用它来测试我的代码? 非常感谢你提前...
答案 0 :(得分:2)
你的代码应该正常工作..可能你错过了别的东西.. 请尝试此代码..
ALTER PROCEDURE dbo.sp_SerializeJsonFromTable
AS
Declare @json NVARCHAR(MAX)
Declare @Id int
Select *
Into #Temp
From TTAuditLog
CREATE TABLE #Temp1
(
Date_Time varchar(50),
Exch varchar(100),
Alias varchar(100),
Broker varchar(100),
Company varchar(100),
Trd_Status varchar(50) ,
Trd_Message varchar(max),
Action varchar(20),
B_S varchar(10),
O_C varchar(10),
C_P varchar(10),
Qty Float(50),
Product varchar(50),
Contract varchar(50),
Strike varchar(50),
Price Float(50),
Order_Type varchar(20),
TIF varchar(20),
Modifier varchar(20),
Trigger_Price Float(50),
TPrice_Type varchar(20),
TPrice_Qty Float(50),
Ticks_Away varchar(10),
Advanced varchar(50),
Disc_Qty Float(50),
Variance_pct Float(10),
Duration varchar(20),
Interval varchar(20),
Retries varchar(10),
Leftover_Act varchar(20),
Exec_Qty Float(50),
Work_Qty Float(50),
Cxl_Qty Float(50),
Legged_Qty Float(50),
Pending_Qty Float(50),
Undisclosed_Qty Float(50),
Acc_Number varchar(50),
Risk_Account varchar(50),
Exch_Mbr varchar(20),
Exch_Grp varchar(20),
Exch_Trd varchar(20),
Username varchar(50),
Exch_Cred varchar(50),
Trd_Mbr varchar(20),
Trd_Grp varchar(20),
Trd_ID varchar(20),
Acct varchar(20),
Give_Up varchar(20),
Cntr_Party varchar(50),
Exch_Time Time,
Exch_Date DateTime,
Time_Sent Time,
Src varchar(20),
Time_Proc varchar(20),
P_A varchar(10),
Owner varchar(20),
Order_Num varchar(20),
TT_Order_Key varchar(20),
Rel_Key varchar(20),
Parent_Key varchar(20),
Link_Type varchar(20),
SE_Server varchar(50),
IP_Address varchar(20),
FFT2 varchar(10),
FFT3 varchar(10),
FFT4 varchar(10),
FFT5 varchar(10),
FFT6 varchar(10),
UserTag varchar(20),
OrderTag varchar(20),
Dir_Elec_Access varchar(20),
Trading_Capacity varchar(20),
Liq_Prov varchar(20),
Cmdty_Der_Ind varchar(10),
Inv_Decision varchar(20),
Exec_Decision varchar(20),
Client varchar(20),
Start_Time Time,
Start_Date DateTime,
End_Time Time,
End_Date DateTime,
End_Behavior varchar(20),
TransID varchar(20),
Session_ID varchar(10),
Mon_Username varchar(20),
Callback_Rec varchar(10),
SeriesKey varchar(20),
Exch_Order_ID varchar(20),
Destination varchar(20),
FlowDel_Unit varchar(20),
Time_Rec varchar(20),
Order_Src_Hist varchar(20),
Last_Ord_Src varchar(20)
)
While (Select Count(*) From #Temp) > 0
Begin
Select Top 1 @Id = Id, @json = JsonValue From #Temp
--PRINT @json
--SET @json = 'N' + @json
--Declare @sql varchar(max)
INSERT INTO #Temp1 SELECT * FROM
OPENJSON (@json)
WITH (
Date_Time varchar(50) '$."Time"',
Exch varchar(50) '$."Exch"',
Alias varchar(100) '$."Alias"',
Broker varchar(100) '$."Broker"',
Company varchar(100) '$."Company"',
Trd_Status varchar(50) '$."Status"',
Trd_Message varchar(200) '$."Msg"',
Action varchar(20) '$."Action"',
B_S varchar(10) '$."B_S"',
O_C varchar(10) '$."O_C"',
C_P varchar(10) '$."C_P"',
Qty Float(50) '$."Qty"',
Product varchar(50) '$."Product"',
Contract varchar(50) '$."Contract"',
Strike varchar(50) '$."Strike"',
Price Float(50) '$."Price"',
Order_Type varchar(20) '$."OrderType"',
TIF varchar(20) '$."TIF"',
Modifier varchar(20) '$."Modifier"',
Trigger_Price Float(50) '$."TriggerPrice"',
TPrice_Type varchar(20) '$."TPriceType"',
TPrice_Qty Float(50) '$."TPriceQty"',
Ticks_Away varchar(10) '$."TicksAway"',
Advanced varchar(50) '$."Advanced"',
Disc_Qty Float(50) '$."DiscQty"',
Variance_pct Float(10) '$."Variance"',
Duration varchar(20) '$."Duration"',
Interval varchar(20) '$."Interval"',
Retries varchar(10) '$."Retries"',
Leftover_Act varchar(20) '$."LeftoverAction"',
Exec_Qty Float(50) '$."ExecQty"',
Work_Qty Float(50) '$."WorkQty"',
Cxl_Qty Float(50) '$." CxlQty"',
Legged_Qty Float(50) '$."LeggedQty"',
Pending_Qty Float(50) '$."PendingQty"',
Undisclosed_Qty Float(50) '$."UndisclosedQty"',
Acc_Number varchar(50) '$."AccountNumber"',
Risk_Account varchar(50) '$."RiskAccount"',
Exch_Mbr varchar(20) '$."ExchMbr"',
Exch_Grp varchar(20) '$."ExchGrp"',
Exch_Trd varchar(20) '$."ExchTrd"',
Username varchar(50) '$."Username"',
Exch_Cred varchar(50) '$."ExchCred"',
Trd_Mbr varchar(20) '$."TrdMbr"',
Trd_Grp varchar(20) '$."TrdGrp"',
Trd_ID varchar(20) '$."TrdID"',
Acct varchar(20) '$."Acct"',
Give_Up varchar(20) '$."GiveUp"',
Cntr_Party varchar(50) '$."CntrParty"',
Exch_Time Time '$."ExchTime"',
Exch_Date DateTime '$."ExchDate"',
Time_Sent Time '$."TimeSent"',
Src varchar(20) '$."Source"',
Time_Proc varchar(20) '$."TimeProcessed"',
P_A varchar(10) '$."P_A"',
Owner varchar(20) '$."Owner"',
Order_Num varchar(20) '$."OrderNumber"',
TT_Order_Key varchar(20) '$."TTOrderKey"',
Rel_Key varchar(20) '$."RelatedKey"',
Parent_Key varchar(20) '$."ParentKey"',
Link_Type varchar(20) '$."LinkType"',
SE_Server varchar(50) '$."SEServer"',
IP_Address varchar(20) '$."IPAddress"',
FFT2 varchar(10) '$."FFT2"',
FFT3 varchar(10) '$."FFT3"',
FFT4 varchar(10) '$."FFT4"',
FFT5 varchar(10) '$."FFT5"',
FFT6 varchar(10) '$."FFT6"',
UserTag varchar(20) '$."UserTag"',
OrderTag varchar(20) '$."OrderTag"',
Dir_Elec_Access varchar(20) '$."DirectElectronicAccess"',
Trading_Capacity varchar(20) '$."TradingCapacity"',
Liq_Prov varchar(20) '$."LiquidityProvision"',
Cmdty_Der_Ind varchar(10) '$."CommodityDerivativeIndicator"',
Inv_Decision varchar(20) '$."InvestmentDecision"',
Exec_Decision varchar(20) '$."ExecutionDecision"',
Client varchar(20) '$."Client"',
Start_Time Time '$."StartTime"',
Start_Date DateTime '$."StartDate"',
End_Time Time '$."EndTime"',
End_Date DateTime '$."EndDate"',
End_Behavior varchar(20) '$."EndBehavior"',
TransID varchar(20) '$."TransID"',
Session_ID varchar(10) '$."SessionID"',
Mon_Username varchar(20) '$."MonitoringUsername"',
Callback_Rec varchar(10) '$."CallbackReceived"',
SeriesKey varchar(20) '$."SeriesKey"',
Exch_Order_ID varchar(20) '$."ExchangeOrderID"',
Destination varchar(20) '$."Destination"',
FlowDel_Unit varchar(20) '$."FlowDeliveryUnit"',
Time_Rec varchar(20) '$."TimeReceived"',
Order_Src_Hist varchar(20) '$."OrderSourceHistory"',
Last_Ord_Src varchar(20) '$."LastOrderSource"'
)
Delete #Temp Where Id = @Id
End
SELECT * From #Temp1 order by Date_Time
#Find the cube root of a perfect cube
x = int(raw_input('Enter an integer: '))
ans = 0
while ans**3 < abs(x):
ans = ans + 1
if ans**3 != abs(x):
print x, 'is not a perfect cube'
else:
if x < 0:
ans = -ans
print 'Cube root of ' + str(x) + ' is ' + str(ans)
答案 1 :(得分:1)
在ubuntu中,你应该这样运行chrome实例
whereis google-chrome
找到您的可执行文件
/usr/bin/google-chrome --unsafely-treat-insecure-origin-as-secure=http://your-domain.dev:80
记得在执行此操作之前关闭所有其他 chrome 实例 (pkill -9 chrome)
答案 2 :(得分:0)
请检查浏览器版本是否支持通知,并尝试使用http:// {localhost ip} instad of localhost / xyz。
答案 3 :(得分:-2)
您应该尝试PushJS,https://pushjs.org
它是一个轻松创建桌面通知的插件。 如果它是新的,请参见此https://tutorialzine.com/2017/01/the-easiest-way-to-show-browser-notifications。
希望它有所帮助!
<强>更新强>
PushJS使用您正在谈论的相同Notification API。
它使创建和管理浏览器通知变得更加容易。阅读我上面提到的文章。
&#34; Push.js库不是使用Web Notifications所必需的,但它提供了一个干净的API,与本机Notification API相比,它更容易使用。 Push.js将处理权限,服务工作者和跨浏览器的不一致,因此我们不必这样做。&#34; - 来自Tutorialzine的文章