分类
外汇交易市场策略

量化投资学习

Getting started with uinput: the user level input subsystem

uinput is a linux kernel module that allows to handle the input subsystem from user land. It 量化投资学习 can be used to create and to handle input devices from an application. It creates a character device in /dev/input directory. The device is a virtual interface, it doesn't belong to a physical device.

In this document, we will see how to create a such input device and how it can be used.

1. Creating an input device

Once the uinput module is installed (via modprobe or insmod), a character device is created, named as /dev/input/uinput (or /dev/uinput on some systems). This device represents the interface between the application and the kernel input subsystem.

To use uinput, we need to open the character device in write-only and non-blocking mode:

Now the device is opened, we will configure our input device. First, we need to inform 量化投资学习 the input subsystem which types of input event we want to use. Types of events are defined in /usr/include/linux/input.h :

/usr/include/linux/input.h

  • EV_KEY type represents key press and release events,
  • EV_REL type represents relative axis events (such as mouse movements),
  • EV_ABS type represents absolute axis events (such as touchscreen movements),

The ioctl request UI_SET_EVBIT applied on the uinput file descriptor is used to enable a type of event. The two following lines enable key press/release and synchronization events.

When enabling EV_KEY events, we need to describe which keycodes are allowed to be sent via the input subsystem.

As linux/input.h defines the 'd' key as KEY_D , we can enable the keycode representing the 'd' key by using:

Now 量化投资学习 some basic features have been enabled, we need to finish the configuration by using the struct uinput_user_dev from linux/uinput.h . This structure is defined as:

/usr/include/linux/uinput.h

The most important fields are:

  • name is the given name to the input device we will create,
  • id is a linux internal structure that describes the device bustype, vendor id, product id and version,
  • 量化投资学习
  • absmin and absmax are integer array that defines mininal and maximal values for an absolute axis (i.e absmin[ABS_X] = 0 , absmax[ABS_X] = 1024 for the X axis on a touchscreen device).

Now, we can fill this structure with appropriate values:

Then, we write this structure in the uinput file descriptor.

Last step is to request the creation of the device via the UI_DEV_CREATE ioctl request on the file descriptor:

Now, the file descriptor fd represents the end-point file descriptor of the new input device.

2. Injecting events in the input subsystem

The following block code injects a key press event in the input subsystem. The input_event structure contains 3 important fields:

  • type : is an event type ( EV_KEY , EV_ABS , EV_REL , . ),
  • code : could be either a key code when using EV_KEY , or an axis for EV_ABS and EV_REL ,
  • value : may be 1 (press) or 0 (release) for EV_KEY , or any values for others (positive integer for EV_ABS , signed integer for EV_REL , etc…).

To 量化投资学习 inject a press event on the 'd' key:

3. Destroying an 量化投资学习 input device

4. Handling absolute axis events

If we want to inject absolute events, 量化投资学习 量化投资学习 we first need to activate EV_ABS event and the desired axes support with ioctl requests. The following ioctl requests enable X and Y absolute axes:

Then we need to defined a range of values for each axis with absmin and absmax fields from the uinput_user_dev structure:

starsfamily/PyStudio

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There 量化投资学习 was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

About

Stars

Watchers

Forks

Releases

Packages 0

Languages

Footer

© 2022 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

kissnono(塔.拉夏的灵魂)请进,关于datagrid多选!

Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
Dim posdg As Point = New Point(e.X, e.Y)
Dim hitDG As DataGrid.HitTestInfo = HitTest(posdg)
If HitDataGrid(hitDG) Then
MyBase.OnMouseDown(e)
End If
End Sub

Private Function HitDataGrid(ByVal Hit As DataGrid.HitTestInfo) As Boolean
Try
Select Case Me.ModifierKeys
Case Keys.Control
If Hit.Row > -1 Then
If m.IndexOf(Hit.Row) > -1 Then
m.Remove(Hit.Row)
Me.量化投资学习 UnSelect(Hit.Row)
Else
m.Add(Hit.Row)
Me.Select(Hit.Row)
End If
End If
Return False
Case Keys.Shift
If Hit.Row > -1 Then
For Each IndexOld As Integer In m
Me.UnSelect(IndexOld)
Next
m.Clear()
Dim i, intStep As Integer
If Hit.Row > Me.CurrentRowIndex Then
intStep = 1
Else
intStep = -1
End If
For i = Me.CurrentRowIndex To Hit.Row Step intStep
m.Add(i)
Me.Select(i)
Next
End If
Return False
Case Else
For Each index As Integer In m
Me.UnSelect(index)
Next
m.Clear()
If Hit.Type = DataGrid.HitTestType.RowHeader Then
m.Add(Hit.Row)
End If
Return True
End Select
Catch ex As Exception
Debug.WriteLine(ex.ToString)
End Try
End Function
End Class
这次正确,上次的那个在ReadOnly从TRUE变为FALSE后,单击其他cell,选择的行不消失.

Public Class MyDataGridCLASS
Inherits DataGrid
Private m As New ArrayList

Public ReadOnly Property MultiSelectedIndex() As Integer()
Get
Return m.ToArray(GetType(Integer))
End Get
End Property

Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
Dim posdg As Point = New Point(e.X, e.Y)
Dim hitDG As DataGrid.HitTestInfo = HitTest(posdg)
If HitDataGrid(hitDG) Then
MyBase.OnMouseDown(e)
End If
End Sub

Private Function HitDataGrid(ByVal Hit As DataGrid.HitTestInfo) As Boolean
Try
Select Case Me.ModifierKeys
Case Keys.Control
If Hit.Row > -1 Then
If m.IndexOf(Hit.Row) > -1 Then
m.Remove(Hit.Row)
Me.UnSelect(Hit.Row)
Else
m.Add(Hit.Row)
Me.Select(Hit.Row)
End If
End If
Return False
Case Keys.Shift
If Hit.Row > -1 Then
For Each IndexOld As Integer In m
Me.UnSelect(IndexOld)
Next
m.Clear()
Dim i, intStep As Integer
If Hit.Row > Me.CurrentRowIndex Then
intStep = 1
Else
intStep = -1
End If
For i = Me.CurrentRowIndex To Hit.Row Step intStep
m.Add(i)
Me.Select(i)
Next
End If
Case Else
m.Clear()
If Hit.Type = DataGrid.HitTestType.RowHeader Then
m.Add(Hit.Row)
End If
Return True
End Select
Catch ex As Exception 量化投资学习
Debug.WriteLine(ex.ToString)
End Try
End Function
End Class

量化投资学习

* 模拟sql注入,使用preparedstatment防止sql注入import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException;import java.

实验二 Java面向对象程序设计实验报告_weixin_30827565的博客-程序员秘密

实验二 Java面向对象程序设计实验内容1.初步掌握单元测试和TDD2.理解并掌握面向对象三要素:封装、继承、多态3.初步掌握UML建模4.熟悉S.O.L.I.D原则5.了解设计模式实验要求1.没有Linux基础的同学建议先学习《Linux基础入门(新版)》《Vim编辑器》 课程2.完成实验、撰写实验报告,实验报告以博客方式发表在博客园,注意实验报告重点是运行结果,遇到的问.

Unity应用架构设计(1)—— MVVM 模式的设计和实施(Part 1)_weixin_34112208的博客-程序员秘密

初识 MVVM谈起 MVVM 设计模式,可能第一映像你会想到 WPF/Sliverlight,他们提供了的数据绑定(Data Binding),命令(Command)等功能,这让 MVVM 模式得到很好的实现。MVVM 设计模式顾名思义,通过分离关注点,各司其职。通过 Data Binding 可达到数据的双向绑定,而命令 Command 更是将传统的 Code Behind 事件独立到 Vie.

Hadoop安装记录(伪分布式)_Michaelwubo的博客-程序员秘密

下面给大家分享一下我在安装Hadoop时候的一些步骤记录,希望能给大家带来帮助,我安装的是单节点的伪分布式。 1.基本环境:VMware8.0 + CentOS 6.0 2.软件版本:hadoop-0.20.2-cdh3u1.tar.gz + jdk-6u29-linux-i586.bin 第一步,将所需要的软件从本地共享到虚拟机,我们可以使用VMware Tools的

iOS UIButton选中状态下点击高亮_Enjolras1024的博客-程序员秘密

只需将状态设置为UIControlStateSelected | UIControlStateHighlighted即可 [self.followBtn setBackgroundImage:[UIImage imageNamed:@"beckoning_btn2"] forState:UIControlStateSelected | UIControlStateHighligh

win10配置python环境变量_暖光灯下旋转的便利店热狗的博客-程序员秘密_python配置环境变量win10

右键点击“此电脑”,左键点击“量化投资学习 属性”。 点击“高级系统设置”。 点击“环境变量”。 双击“path”。 点击“新建”,将python安装目录加入。