CentOS7でNTPサーバーを構築

NTPをインストールする。

# yum -y install ntp

設定ファイルを変更する。

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
server ntp1.jst.mfeed.ad.jp iburst
server ntp2.jst.mfeed.ad.jp iburst
server ntp3.jst.mfeed.ad.jp iburst

ファイアウォールに例外を追加する。

# firewall-cmd --add-service ntp --permanent
# firewall-cmd --reload

サービスの自動起動を有効にして起動もする。

# systemctl enable ntpd
# systemctl start ntpd

※補足
タイムゾーンをJSTに変更するには…

# cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

LibreOfficeのVBでADODBでデータベースに接続する(Windows限定)

Dim connection As Object
Dim recordset As Object
Dim command As Object
connection = CreateObject("ADODB.Connection")
recordset = CreateObject("ADODB.Recordset")
command = CreateObject("ADODB.Command")

'SQLServerに接続してみる
connection.Open "Provider=SQLOLEDB;Data Source=DB_SERVER\SQLEXPRESS;Initial Catalog=DB_NAME;User ID=sa;Password=123456;"

command.ActiveConnection = connection
command.CommandTimeout = 0
command.CommandText = "SELECT * FROM TABLE_NAME;"
recordset = command.Execute

If recordset.RecordCount > 0 Then
    If recordset.Eof = false Then
       recordset.MoveFirst
     MsgBox(recordset.Fields.Item("field1").Value)
       'MsgBox(recordset.Fields.Item("field1").Name) ←これは使えない
 End If
End if

LibreOfficeのCalcでページスタイルを変更する

Dim styleFamilies As Object
styleFamilies = ThisComponent.StyleFamilies
Dim styles As Object
styles = styleFamilies.getByName("PageStyles")
Dim style As Object
style = styles.getByName("標準")
style.HeaderIsOn = False 'ヘッダーOFF
style.FooterIsOn = False 'フッターOFF
style.CenterHorizontally = True '横方向中央配置
style.Height = 25000 '用紙高さ250mm
style.Width = 17600 '用紙幅176mm
style.scaleToPages = 1 '1ページに収める

主なプロパティ

プロパティ
CenterHorizontally boolean
CenterVertically boolean
PrintAnnotations boolean
PrintGrid boolean
PrintHeaders boolean
PrintCharts boolean
PrintObjects boolean
PrintDrawing boolean
PrintFormulas boolean
PrintZeroValues boolean
PrintDownFirst boolean
LeftPageHeaderContent XHeaderFooterContent
LeftPageFooterContent XHeaderFooterContent
RightPageHeaderContent XHeaderFooterContent
RightPageFooterContent XHeaderFooterContent
FirstPageNumber short
PageScale short
ScaleToPages short
ScaleToPagesX short
ScaleToPagesY short
BackColor ::com::sun::star::util::Color
BackGraphicURL string
BackGraphicFilter string
BackGraphicLocation GraphicLocation
BackTransparent boolean
LeftMargin long
RightMargin long
TopMargin long
BottomMargin long
LeftBorder ::com::sun::star::table::BorderLine
RightBorder ::com::sun::star::table::BorderLine
TopBorder ::com::sun::star::table::BorderLine
BottomBorder ::com::sun::star::table::BorderLine
LeftBorderDistance long
RightBorderDistance long
TopBorderDistance long
BottomBorderDistance long
ShadowFormat ::com::sun::star::table::ShadowFormat
IsLandscape boolean
NumberingType short
PageStyleLayout PageStyleLayout
PrinterPaperTray string
RegisterModeActive boolean
RegisterParagraphStyle string
Size ::com::sun::star::awt::Size
Width long
Height long
TextColumns ::com::sun::star::text::XTextColumns
UserDefinedAttributes ::com::sun::star::container::XNameContainer
HeaderBackColor [ maybevoid ] ::com::sun::star::util::Color
HeaderBackGraphicURL [ maybevoid ] string
HeaderBackGraphicFilter [ maybevoid ] string
HeaderBackGraphicLocation [ maybevoid ] GraphicLocation
HeaderLeftMargin [ maybevoid ] long
HeaderRightMargin [ maybevoid ] long
HeaderBackTransparent [ maybevoid ] boolean
HeaderLeftBorder [ maybevoid ] ::com::sun::star::table::BorderLine
HeaderRightBorder [ maybevoid ] ::com::sun::star::table::BorderLine
HeaderTopBorder [ maybevoid ] ::com::sun::star::table::BorderLine
HeaderBottomBorder [ maybevoid ] ::com::sun::star::table::BorderLine
HeaderLeftBorderDistance [ maybevoid ] long
HeaderRightBorderDistance [ maybevoid ] long
HeaderTopBorderDistance [ maybevoid ] long
HeaderBottomBorderDistance [ maybevoid ] long
HeaderShadowFormat [ maybevoid ] ::com::sun::star::table::ShadowFormat
HeaderBodyDistance [ maybevoid ] long
HeaderIsShared [ maybevoid ] boolean
HeaderHeight [ maybevoid ] long
HeaderIsDynamicHeight [ maybevoid ] boolean
HeaderIsOn boolean
HeaderText [ maybevoid ] ::com::sun::star::text::XText
HeaderTextLeft [ maybevoid ] ::com::sun::star::text::XText
HeaderTextRight [ maybevoid ] ::com::sun::star::text::XText
FooterBackColor [ maybevoid ] ::com::sun::star::util::Color
FooterBackGraphicURL [ maybevoid ] string
FooterBackGraphicFilter [ maybevoid ] string
FooterBackGraphicLocation [ maybevoid ] GraphicLocation
FooterLeftMargin [ maybevoid ] long
FooterRightMargin [ maybevoid ] long
FooterBackTransparent [ maybevoid ] boolean
FooterLeftBorder [ maybevoid ] ::com::sun::star::table::BorderLine
FooterRightBorder [ maybevoid ] ::com::sun::star::table::BorderLine
FooterTopBorder [ maybevoid ] ::com::sun::star::table::BorderLine
FooterBottomBorder [ maybevoid ] ::com::sun::star::table::BorderLine
FooterLeftBorderDistance [ maybevoid ] long
FooterRightBorderDistance [ maybevoid ] long
FooterTopBorderDistance [ maybevoid ] long
FooterBottomBorderDistance [ maybevoid ] long
FooterShadowFormat [ maybevoid ] ::com::sun::star::table::ShadowFormat
FooterBodyDistance [ maybevoid ] long
FooterIsDynamicHeight [ maybevoid ] boolean
FooterIsShared [ maybevoid ] boolean
FooterHeight [ maybevoid ] long
FooterIsOn boolean
FooterText [ maybevoid ] ::com::sun::star::text::XText
FooterTextLeft [ maybevoid ] ::com::sun::star::text::XText
FooterTextRight [ maybevoid ] ::com::sun::star::text::XText
FootnoteHeight long
FootnoteLineWeight short
FootnoteLineColor ::com::sun::star::util::Color
FootnoteLineRelativeWidth byte
FootnoteLineAdjust short
FootnoteLineTextDistance long
FootnoteLineDistance long
WritingMode short
GridMode short
GridColor ::com::sun::star::util::Color
GridLines short
GridBaseHeight long
GridRubyHeight long
GridRubyBelow boolean
GridPrint boolean
GridDisplay boolean
HeaderDynamicSpacing [ maybevoid ] boolean
FooterDynamicSpacing [ maybevoid ] boolean
BorderDistance long
FooterBorderDistance [ maybevoid ] long
HeaderBorderDistance [ maybevoid ] long

LibreOfficeのCalcでActiveSheetに対してスタイルを適用する

Dim document As Object
Dim dispatcher As Object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

Dim args(1) As new com.sun.star.beans.PropertyValue
args(0).Name = "Template"
args(0).Value = "標準"
args(1).Name = "Family"
args(1).Value = 8 'シートに適用する場合は8

dispatcher.executeDispatch(document, ".uno:StyleApply", "", 0, args())

LibreOfficeのCalcでシートを他ドキュメントにコピーする

コピー先ドキュメントを指定する場合は args(0).Value の箇所にTitleを指定する。TitleはgetArgs()メソッドで取得できる配列から取得する。※ドキュメントのウインドウタイトルとは異なるので注意

Dim newSheetName As String
newSheetName = "コピー先"
ThisComponent.Sheets.copyByName("コピー元シート名", newSheetName, 0)
ThisComponent.CurrentController.Select(ThisComponent.Sheets.getByName(newSheetName))
Dim document as Object
Dim dispatcher as Object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
Dim args(2) as new com.sun.star.beans.PropertyValue
args(0).Name = "DocName"
args(0).Value = ""
args(1).Name = "Index"
args(1).Value = 32767
args(2).Name = "Copy"
args(2).Value = false
dispatcher.executeDispatch(document, ".uno:Move", "", 0, args())

LibreOfficeのMsgBoxについて

MsgBox("メッセージ", 1, "タイトル") 'メッセージ/Type/タイトルを指定

Type引数

0 OKのみ
1 OK、キャンセル
2 中止、やり直し、取消し
3 はい、いいえ、キャンセル
4 はい、いいえ
5 やり直し、キャンセル
16 ストップアイコンを表示
32 疑問符アイコンを表示
48 エクスクラメーションアイコンを表示
64 インフォメーションアイコン
128 1番目のボタンをデフォルト
256 2番目のボタンをデフォルト
512 3番目のボタンをデフォルト

戻り値

1 OK
2 キャンセル
3 中止
4 やり直し
5 無視
6 はい
7 いいえ