- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 Visual Studio 2013 for Visual Basic,我希望能够测试扬声器是插入还是从扬声器插孔中拔出。是否可以?
最佳答案
可以使用设备拓扑 API 来完成。 IKsJackDescription
接口(interface)可用于获取KSJACK_DESCRIPTION
结构,其中有 IsConnected
成员。但是,并非每个设备都支持电缆存在检测,如果不支持,API 将始终报告它已连接。
COM 对象声明
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Runtime.InteropServices
Imports System.IO
Imports System.Runtime.CompilerServices
Namespace com_test
Class Native
<DllImport("ole32.Dll")> _
Public Shared Function CoCreateInstance(ByRef clsid As Guid, <MarshalAs(UnmanagedType.IUnknown)> inner As Object, context As UInteger, ByRef uuid As Guid, <MarshalAs(UnmanagedType.IUnknown)> ByRef rReturnedComObject As Object) As UInteger
End Function
'************************************************************************
<DllImport("ole32.dll")> _
Private Shared Function PropVariantClear(ByRef pvar As PropVariant) As Integer
End Function
Public Const DEVICE_STATE_ACTIVE As Integer = &H1
Public Const DEVICE_STATE_DISABLE As Integer = &H2
Public Const DEVICE_STATE_NOTPRESENT As Integer = &H4
Public Const DEVICE_STATE_UNPLUGGED As Integer = &H8
Public Const DEVICE_STATEMASK_ALL As Integer = &Hf
Public Shared PKEY_Device_FriendlyName As New PROPERTYKEY(&Ha45c254eUI, &Hdf1c, &H4efd, &H80, &H20, &H67, _
&Hd1, &H46, &Ha8, &H50, &He0, 14)
Public Shared PKEY_AudioEndpoint_FormFactor As New PROPERTYKEY(&H1da5d803, &Hd492, &H4edd, &H8c, &H23, &He0, _
&Hc0, &Hff, &Hee, &H7f, &He, 0)
End Class
Enum EndpointFormFactor
RemoteNetworkDevice = 0
Speakers = (RemoteNetworkDevice + 1)
LineLevel = (Speakers + 1)
Headphones = (LineLevel + 1)
Microphone = (Headphones + 1)
Headset = (Microphone + 1)
Handset = (Headset + 1)
UnknownDigitalPassthrough = (Handset + 1)
SPDIF = (UnknownDigitalPassthrough + 1)
DigitalAudioDisplayDevice = (SPDIF + 1)
UnknownFormFactor = (DigitalAudioDisplayDevice + 1)
EndpointFormFactor_enum_count = (UnknownFormFactor + 1)
End Enum
Enum EPcxConnectionType
eConnTypeUnknown = 0
eConnType3Point5mm
eConnTypeQuarter
eConnTypeAtapiInternal
eConnTypeRCA
eConnTypeOptical
eConnTypeOtherDigital
eConnTypeOtherAnalog
eConnTypeMultichannelAnalogDIN
eConnTypeXlrProfessional
eConnTypeRJ11Modem
eConnTypeCombination
End Enum
Enum EPcxGeoLocation
eGeoLocRear = &H1
eGeoLocFront
eGeoLocLeft
eGeoLocRight
eGeoLocTop
eGeoLocBottom
eGeoLocRearPanel
eGeoLocRiser
eGeoLocInsideMobileLid
eGeoLocDrivebay
eGeoLocHDMI
eGeoLocOutsideMobileLid
eGeoLocATAPI
eGeoLocNotApplicable
eGeoLocReserved6
EPcxGeoLocation_enum_count
End Enum
Public Enum EDataFlow
eRender
eCapture
eAll
EDataFlow_enum_count
End Enum
Public Enum ERole
eConsole
eMultimedia
eCommunications
ERole_enum_count
End Enum
Public Enum CLSCTX
CLSCTX_INPROC_SERVER = &H1
CLSCTX_INPROC_HANDLER = &H2
CLSCTX_LOCAL_SERVER = &H4
CLSCTX_REMOTE_SERVER = &H10
CLSCTX_SERVER = (CLSCTX_INPROC_SERVER Or CLSCTX_LOCAL_SERVER Or CLSCTX_REMOTE_SERVER)
CLSCTX_ALL = (CLSCTX_INPROC_HANDLER Or CLSCTX_SERVER)
End Enum
'Windows Core Audio API declarations
'http://www.java2s.com/Code/CSharp/Windows/SoundUtils.htm
<Guid("0BD7A1BE-7A1A-44DB-8397-CC5392387B5E"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IMMDeviceCollection
Function GetCount(ByRef pcDevices As UInteger) As Integer
Function Item(nDevice As UInteger, <Out, MarshalAs(UnmanagedType.[Interface])> ByRef ppDevice As Object) As Integer
End Interface
<Guid("D666063F-1587-4E43-81F1-B948E807363F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IMMDevice
Function Activate(ByRef iid As Guid, dwClsCtx As UInteger, pActivationParams As IntPtr, <Out, MarshalAs(UnmanagedType.[Interface])> ByRef ppInterface As Object) As Integer
Function OpenPropertyStore(stgmAccess As Integer, <Out, MarshalAs(UnmanagedType.[Interface])> ByRef ppProperties As Object) As Integer
Function GetId(ByRef ppstrId As StringBuilder) As Integer
Function GetState(ByRef pdwState As Integer) As Integer
End Interface
<ComImport, Guid("BCDE0395-E52F-467C-8E3D-C4579291692E")> _
Class MMDeviceEnumerator
End Class
<Guid("A95664D2-9614-4F35-A746-DE8DB63617E6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IMMDeviceEnumerator
Function EnumAudioEndpoints(dataFlow As EDataFlow, dwStateMask As Integer, <Out, MarshalAs(UnmanagedType.[Interface])> ByRef ppDevices As Object) As Integer
Function GetDefaultAudioEndpoint(dataFlow As EDataFlow, role As ERole, <Out, MarshalAs(UnmanagedType.[Interface])> ByRef ppEndpoint As Object) As Integer
Function GetDevice(pwstrId As String, ByRef ppDevice As IntPtr) As Integer
Function RegisterEndpointNotificationCallback(pClient As IntPtr) As Integer
Function UnregisterEndpointNotificationCallback(pClient As IntPtr) As Integer
End Interface
'*********** Property store *****************************
' https://blogs.msdn.microsoft.com/adamroot/2008/04/11/interop-with-propvariants-in-net/
<ComImport, Guid("886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Interface IPropertyStore
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType := MethodCodeType.Runtime)> _
Sub GetCount(<Out> ByRef cProps As UInteger)
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType := MethodCodeType.Runtime)> _
Sub GetAt(<[In]> iProp As UInteger, ByRef pkey As PROPERTYKEY)
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType := MethodCodeType.Runtime)> _
Function GetValue(<[In]> ByRef key As PROPERTYKEY, ByRef pv As PropVariant) As Integer
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType := MethodCodeType.Runtime)> _
Sub SetValue(<[In]> ByRef key As PROPERTYKEY, <[In]> ByRef pv As Object)
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType := MethodCodeType.Runtime)> _
Sub Commit()
End Interface
<StructLayout(LayoutKind.Sequential, Pack := 4)> _
Structure PROPERTYKEY
Public fmtid As Guid
Public pid As UInteger
Public Sub New(guid As Guid, propertyId As Integer)
Me.fmtid = guid
Me.pid = CUInt(propertyId)
End Sub
Public Sub New(formatId As String, propertyId As Integer)
Me.New(New Guid(formatId), propertyId)
End Sub
Public Sub New(a As UInteger, b As UInteger, c As UInteger, d As UInteger, e As UInteger, f As UInteger, _
g As UInteger, h As UInteger, i As UInteger, j As UInteger, k As UInteger, propertyId As Integer)
Me.New(New Guid(CUInt(a), CUShort(b), CUShort(c), CByte(d), CByte(e), CByte(f), _
CByte(g), CByte(h), CByte(i), CByte(j), CByte(k)), propertyId)
End Sub
End Structure
<StructLayout(LayoutKind.Sequential)> _
Public Structure PropVariant
Private vt As UShort
Private wReserved1 As UShort
Private wReserved2 As UShort
Private wReserved3 As UShort
Private p As IntPtr
Private p2 As Integer
Private Function GetDataBytes() As Byte()
Dim ret As Byte() = New Byte(IntPtr.Size + (4 - 1)) {}
If IntPtr.Size = 4 Then
BitConverter.GetBytes(p.ToInt32()).CopyTo(ret, 0)
ElseIf IntPtr.Size = 8 Then
BitConverter.GetBytes(p.ToInt64()).CopyTo(ret, 0)
End If
BitConverter.GetBytes(p2).CopyTo(ret, IntPtr.Size)
Return ret
End Function
Private ReadOnly Property cVal() As SByte
' CHAR cVal;
Get
Return CSByte(GetDataBytes()(0))
End Get
End Property
Private ReadOnly Property iVal() As Short
' SHORT iVal;
Get
Return BitConverter.ToInt16(GetDataBytes(), 0)
End Get
End Property
Private ReadOnly Property lVal() As Integer
' LONG lVal;
Get
Return BitConverter.ToInt32(GetDataBytes(), 0)
End Get
End Property
Private ReadOnly Property hVal() As Long
' LARGE_INTEGER hVal;
Get
Return BitConverter.ToInt64(GetDataBytes(), 0)
End Get
End Property
Private ReadOnly Property fltVal() As Single
' FLOAT fltVal;
Get
Return BitConverter.ToSingle(GetDataBytes(), 0)
End Get
End Property
Public ReadOnly Property Value() As Object
Get
Select Case CType(vt, VarEnum)
Case VarEnum.VT_I1
Return cVal
Case VarEnum.VT_I2
Return iVal
Case VarEnum.VT_I4, VarEnum.VT_INT
Return lVal
Case VarEnum.VT_UI4, VarEnum.VT_I8
Return hVal
Case VarEnum.VT_R4
Return fltVal
Case VarEnum.VT_FILETIME
Return DateTime.FromFileTime(hVal)
Case VarEnum.VT_BSTR
Return Marshal.PtrToStringBSTR(p)
Case VarEnum.VT_BLOB
Dim blobData As Byte() = New Byte(lVal - 1) {}
Dim pBlobData As IntPtr
If IntPtr.Size = 4 Then
pBlobData = New IntPtr(p2)
ElseIf IntPtr.Size = 8 Then
pBlobData = New IntPtr(BitConverter.ToInt64(GetDataBytes(), 4))
Else
Throw New NotSupportedException()
End If
Marshal.Copy(pBlobData, blobData, 0, lVal)
Return blobData
Case VarEnum.VT_LPSTR
Return Marshal.PtrToStringAnsi(p)
Case VarEnum.VT_LPWSTR
Return Marshal.PtrToStringUni(p)
Case VarEnum.VT_UNKNOWN
Return Marshal.GetObjectForIUnknown(p)
Case VarEnum.VT_DISPATCH
Return p
Case Else
Throw New NotSupportedException("0x" + vt.ToString("X4") + " type not supported")
End Select
End Get
End Property
End Structure
'*****************************************************
'Device Topology declarations
<Guid("2A07407E-6497-4A18-9787-32F79BD0D98F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IDeviceTopology
Function GetConnectorCount(<Out> ByRef pConnectorCount As Integer) As Integer
Function GetConnector(nIndex As Integer, ByRef ppConnector As IConnector) As Integer
Function GetSubunitCount(<Out> ByRef pCount As Integer) As Integer
'ISubunit
Function GetSubunit(nIndex As Integer, ByRef ppSubunit As Object) As Integer
Function GetPartById(nId As Integer, ByRef ppPart As IPart) As Integer
Function GetDeviceId(<Out, MarshalAs(UnmanagedType.LPWStr)> ByRef ppwstrDeviceId As String) As Integer
'IPartsList
Function GetSignalPath(pIPartFrom As IPart, pIPartTo As IPart, bRejectMixedPaths As Boolean, ppParts As Object) As Integer
End Interface
<InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("9c2c4058-23f5-41de-877a-df3af236a09e")> _
Public Interface IConnector
Function [GetType](ByRef pType As Integer) As Integer
Function GetDataFlow(ByRef dataFlow As EDataFlow) As Integer
Function ConnectTo(<[In]> connector As IConnector) As Integer
Function Disconnect() As Integer
Function IsConnected(ByRef pbConnected As Boolean) As Integer
Function GetConnectedTo(<MarshalAs(UnmanagedType.[Interface])> ByRef ppConTo As Object) As Integer
Function GetConnectorIdConnectedTo(ByRef ppwstrConnectorId As String) As Integer
Function GetDeviceIdConnectedTo(ByRef ppwstrDeviceId As String) As Integer
End Interface
<Guid("AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IPart
Function GetName(ByRef ppwstrName As StringBuilder) As Integer
Function GetLocalId(ByRef pnId As Integer) As Integer
Function GetGlobalId(ByRef ppwstrGlobalId As StringBuilder) As Integer
Function GetPartType(ByRef pPartType As Integer) As Integer
Function GetSubType(ByRef pSubType As Guid) As Integer
Function GetControlInterfaceCount(ByRef pCount As UInteger) As Integer
'IControlInterface
Function GetControlInterface(nIndex As Integer, ByRef ppFunction As Object) As Integer
'IPartsList[]
Function EnumPartsIncoming(ByRef ppParts As Object) As Integer
'IPartsList[]
Function EnumPartsOutgoing(ByRef ppParts As Object) As Integer
Function GetTopologyObject(<Out, MarshalAs(UnmanagedType.[Interface])> ByRef ppTopology As Object) As Integer
Function Activate(dwClsContext As UInteger, ByRef refiid As Guid, <MarshalAs(UnmanagedType.[Interface])> ByRef interfacePointer As Object) As Integer
'IControlChangeNotify
Function RegisterControlChangeCallback(ByRef riid As Guid, pNofity As Object) As Integer
'IControlChangeNotify
Function UnregisterControlChangeCallback(pNotify As Object) As Integer
End Interface
<ComVisible(False)> _
<ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("4509F757-2D46-4637-8E62-CE7DB944F57B")> _
Public Interface IKsJackDescription
Function GetJackCount(ByRef jacks As UInteger) As Integer
Function GetJackDescription(jack As UInteger, ByRef pDescription As KSJACK_DESCRIPTION) As Integer
End Interface
<StructLayout(LayoutKind.Sequential)> _
Public Structure KSJACK_DESCRIPTION
Public ChannelMapping As UInteger
Public Color As UInteger
Public ConnectionType As UInteger
Public GeoLocation As UInteger
Public GenLocation As UInteger
Public PortConnection As UInteger
Public IsConnected As UInteger
End Structure
End Namespace
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Text
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.ComponentModel
Namespace com_test
Public Partial Class Form1
Inherits Form
'displays device
Private Function PrintDevice(dev As IMMDevice) As String
Dim propertyStore As IPropertyStore = Nothing
Dim pDeviceTopology As IDeviceTopology = Nothing
Dim pConnFrom As IConnector = Nothing
Dim pConnTo As IConnector = Nothing
Dim pPart As IPart = Nothing
Dim pJackDesc As IKsJackDescription = Nothing
Dim desc As New KSJACK_DESCRIPTION()
Dim res As New StringBuilder(300)
Dim o As Object = Nothing
Dim state As Integer = 0
Dim con_count As UInteger = 0
Try
'device name
'STGM_READ
dev.OpenPropertyStore(0, o)
propertyStore = TryCast(o, IPropertyStore)
Dim friendlyName As New PropVariant()
propertyStore.GetValue(Native.PKEY_Device_FriendlyName, friendlyName)
res.AppendLine(friendlyName.Value.ToString())
'form factor
Dim FormFactor As New PropVariant()
propertyStore.GetValue(Native.PKEY_AudioEndpoint_FormFactor, FormFactor)
Dim f As EndpointFormFactor = EndpointFormFactor.UnknownFormFactor
[Enum].TryParse(Of EndpointFormFactor)(FormFactor.Value.ToString(), f)
res.AppendLine("Form factor: " + f.ToString())
dev.GetState(state)
Dim str As String = ""
Select Case state
Case Native.DEVICE_STATE_DISABLE
str = ("Disabled")
Exit Select
Case Native.DEVICE_STATE_NOTPRESENT
str = ("Not present")
Exit Select
Case Native.DEVICE_STATE_UNPLUGGED
str = ("Unplugged")
Exit Select
End Select
If str <> "" Then
res.AppendLine(str)
End If
' DEVICE TOPOLOGY
Dim iidDeviceTopology As New Guid("2A07407E-6497-4A18-9787-32F79BD0D98F")
dev.Activate(iidDeviceTopology, CUInt(CLSCTX.CLSCTX_ALL), IntPtr.Zero, o)
pDeviceTopology = TryCast(o, IDeviceTopology)
pDeviceTopology.GetConnector(0, pConnFrom)
Try
o = Nothing
pConnFrom.GetConnectedTo(o)
pConnTo = TryCast(o, IConnector)
pPart = CType(pConnTo, IPart)
'QueryInterface
Dim iidKsJackDescription As New Guid("4509F757-2D46-4637-8E62-CE7DB944F57B")
pPart.Activate(CUInt(CLSCTX.CLSCTX_INPROC_SERVER), iidKsJackDescription, o)
pJackDesc = CType(o, IKsJackDescription)
If pJackDesc IsNot Nothing Then
con_count = 0
pJackDesc.GetJackCount(con_count)
If con_count > 0 Then
Dim sb As StringBuilder
'display jacks
For i As UInteger = 0 To con_count - 1
pJackDesc.GetJackDescription(i, desc)
sb = New StringBuilder(100)
Dim con_type As EPcxConnectionType = CType(desc.ConnectionType, EPcxConnectionType)
Dim loc As EPcxGeoLocation = CType(desc.GeoLocation, EPcxGeoLocation)
res.Append("* ")
Select Case con_type
Case EPcxConnectionType.eConnType3Point5mm
sb.Append("Jack 3.5 mm ")
Exit Select
Case EPcxConnectionType.eConnTypeAtapiInternal
sb.Append("ATAPI jack")
Exit Select
Case EPcxConnectionType.eConnTypeRCA
sb.Append("RCA jack")
Exit Select
Case EPcxConnectionType.eConnTypeQuarter
sb.Append("1/2 in. jack ")
Exit Select
Case EPcxConnectionType.eConnTypeOtherAnalog
sb.Append("Analog jack ")
Exit Select
Case EPcxConnectionType.eConnTypeOtherDigital
sb.Append("Digital jack ")
Exit Select
Case Else
sb.Append(con_type.ToString() + " ")
Exit Select
End Select
sb.Append("- " + loc.ToString())
'jack location
res.Append(sb.ToString())
If desc.IsConnected = 0 Then
res.AppendLine(": Disconnected")
Else
res.AppendLine(": Connected")
End If
'end for
Next
Else
res.AppendLine("* No jacks")
End If
Else
res.AppendLine("* Unable to get jacks")
End If
Catch ex As COMException
If CUInt(ex.HResult) = &H80070490UI Then
'E_NOTFOUND
res.AppendLine("Disconnected")
Else
res.AppendLine("COM error while getting jacks: " + ex.Message)
End If
Catch ex As Exception
res.AppendLine("Error while getting jacks: " + ex.Message)
End Try
Finally
'clean up resources
If dev IsNot Nothing Then
Marshal.ReleaseComObject(dev)
End If
If propertyStore IsNot Nothing Then
Marshal.ReleaseComObject(propertyStore)
End If
If pDeviceTopology IsNot Nothing Then
Marshal.ReleaseComObject(pDeviceTopology)
pDeviceTopology = Nothing
End If
If pConnFrom IsNot Nothing Then
Marshal.ReleaseComObject(pConnFrom)
pConnFrom = Nothing
End If
If pConnTo IsNot Nothing Then
Marshal.ReleaseComObject(pConnTo)
pConnTo = Nothing
End If
If pPart IsNot Nothing Then
Marshal.ReleaseComObject(pPart)
pPart = Nothing
End If
If pJackDesc IsNot Nothing Then
Marshal.ReleaseComObject(pJackDesc)
pJackDesc = Nothing
End If
End Try
Return res.ToString()
End Function
Public Sub New()
InitializeComponent()
End Sub
Private Sub button_Click(sender As Object, e As EventArgs)
Dim devenum As New MMDeviceEnumerator()
'Create enumerator
Dim deviceEnumerator As IMMDeviceEnumerator = CType(devenum, IMMDeviceEnumerator)
Dim defDevice As IMMDevice = Nothing
Dim propertyStore As IPropertyStore = Nothing
Try
Dim o As Object = Nothing
' * get default device *
deviceEnumerator.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eConsole, o)
defDevice = TryCast(o, IMMDevice)
textBox1.Text = "Default sound device: " + Environment.NewLine + Environment.NewLine
textBox1.Text += PrintDevice(defDevice)
Catch ex As Exception
MessageBox.Show(ex.ToString())
Finally
'clean up resources
If devenum IsNot Nothing Then
Marshal.ReleaseComObject(devenum)
End If
If deviceEnumerator IsNot Nothing Then
Marshal.ReleaseComObject(deviceEnumerator)
End If
If defDevice IsNot Nothing Then
Marshal.ReleaseComObject(defDevice)
End If
If propertyStore IsNot Nothing Then
Marshal.ReleaseComObject(propertyStore)
End If
End Try
End Sub
End Class
End Namespace
关于vb.net - 如何确定扬声器是否插入或拔出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41097521/
我正在使用 Selenium Web 驱动程序 3.0,并且想要从打开的两个对话框(一个在后台,第二个在前台)的 Activity 对话框中单击“确定”按钮。如何从 html 下面的父 div 单击前
actions: [ FlatButton( onPressed: () {
我有一个问题有点超出我的范围(我真的很高兴我是 Beta)涉及重复项(所以 GROUP BY, HAVING, COUNT),通过将解决方案保留在 SQLite 附带的标准函数中而变得更加复杂。我正在
使用DBI是否可以确定SELECT语句的已执行语句句柄是否返回任何行而不从中获取行? IE。就像是: use DBI; ... my $sth = $dbh->prepare("SELECT ..."
是否可以为“确定”和“关闭”按钮指定回调函数? 如果是JQuery Modal,则可以在初始化时使用按钮字典指定回调函数。 Semantic-ui模态是否提供类似的功能?按下确定后,我该如何寻求其他逻
我想阅读警报中的消息。 示例:如果警报显示“错误的电子邮件地址”。怎么读呢?意味着我想将该消息存储在字符串中。 如何在“警报”中单击“确定”...?? 如何使用 Selenium 来做到这一点? 最佳
我有一个删除按钮: 我试图首先查明是否已选择一个网站,如果已选择一个网站,我需要确定是否已选择一个或多个列表项,如果是,则继续删除这些项目。 我的 if 语句不断返回“您必须首先选择您的列表”,即使它
部分出于好奇——我们想知道在我们的应用程序中发生了什么——部分是因为我们需要在我们的代码中找到一些潜在的问题,我喜欢在我们的网络应用程序运行时跟踪一些一般值。这尤其包括某些对象图的分配内存。 我们的应
我将 SweetAlert 与 Symfony 结合使用,我希望用户在完成删除操作之前进行确认。 发生的情况是,当用户单击删除按钮时,SweetAlert 会弹出,然后立即消失,并且该项目被删除。 在
我们有一个应用程序可以生成不包括字母 O 的随机基数 35 [0-9A-Z]。我正在寻找一种解决方案来查找包含任何淫秽英语单词的代码,而无需搜索包含 10,000 个条目的列表每个生成的代码。每秒生成
这是我做的: #include #include int betweenArray(int a, int b){ int *arr,i,range; range = b - a +
我知道如何创建 警报和确认框,但我不知道如何做的是实际单击“确定”。我有一个弹出确认框的页面。 我想使用 Java Script 插件单击“确定”。基本上,我希望我的代码单击页面上的链接,然后在出现提
代码: swal('Your ORDER has been placed Successfully!!!'); window.location="index.php"; 甜蜜警报工
>>> import re >>> s = "These are the words in a sentence" >>> regex = re.compile('are|words') >>> [m
使用确定的理想散列函数给出随机期望线性时间算法两个数组 A[1..n] 和 B[1..n] 是否不相交,即 A 的元素是否也是 B 的元素。 谁能告诉我如何做到这一点,甚至如何开始考虑它? 最佳答案
我在计算机科学课上有这段代码: int input=15; while (input < n ) { input = input *3;} 这段代码有 log3(n/15) 次循环的上限。我们怎样才能
我有一个允许 2 位玩家玩 TicTacToe 的程序。在每个玩家移动之后,它应该在那个点显示棋盘并返回一个名为 Status 的枚举,显示玩家是否应该继续,如果玩家赢了,还是平局。但是,该算法要么返
给定一个 y 值数组,例如 [-3400, -1000, 500, 1200, 3790],我如何确定“好的”Y 轴标签并将它们放置在网格上? ^ ---(6,000)-|---
假设我有一个检查用户登录的 SQL 语句: SELECT * FROM users WHERE username='test@example.com', password='abc123', expi
teradata中有返回表中哪一列被定义为主索引的命令吗?我没有制作一些我正在处理的表,也没有尝试优化我对这些表的连接。谢谢! 最佳答案 有dbc.IndicesV,其中IndexNumber=1表示
我是一名优秀的程序员,十分优秀!