unix

Why (ftruncate+mmap+memcpy) is faster than (write)?

自闭症网瘾萝莉.ら 提交于 2021-02-19 08:13:13
问题 I found a different way to write data, which is faster than normal unix write function. Firstly, ftruncate the file to the length we need, then mmap this block of file, finally, using memcpy to flush the file content. I will give the example code below. As I known, mmap can load the file into the process address space, accelerating by ignoring the page cache. BUT, I don't have any idea why it can fast up the writing speed. Whether I write a wrong test case or it can be a kind of opti trick?

Connect to MSSQL from Spring boot application using windows authentication

孤街醉人 提交于 2021-02-19 02:22:28
问题 I am currently using the below properties to connect to a remotely Mssql server from Java spring boot application: spring.datasource.url=jdbc:sqlserver://ip\\domain;databaseName=name spring.datasource.username=abc spring.datasource.password=def spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver The application runs from both windows and unix servers. I need now to start using the windows authentication instead of the db credentials. This is already configured and

Connect to MSSQL from Spring boot application using windows authentication

我是研究僧i 提交于 2021-02-19 02:22:28
问题 I am currently using the below properties to connect to a remotely Mssql server from Java spring boot application: spring.datasource.url=jdbc:sqlserver://ip\\domain;databaseName=name spring.datasource.username=abc spring.datasource.password=def spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver The application runs from both windows and unix servers. I need now to start using the windows authentication instead of the db credentials. This is already configured and

Program configuration data in Unix/Linux

守給你的承諾、 提交于 2021-02-18 22:38:35
问题 What is recommended way to keep a user configuration data in Unix/Linux? My programming language is C++. Configuration data will be kept in XML/text/binary format, I have no problem with handling such files. I want to know where can I keep them. For example, in the Windows OS configuration data may be kept in the Registry (old way) or in user application data directory. What about Linux? I need read/write access to configuration files. 回答1: The concept of the registry is peculiar to Windows,

Program configuration data in Unix/Linux

烈酒焚心 提交于 2021-02-18 22:37:06
问题 What is recommended way to keep a user configuration data in Unix/Linux? My programming language is C++. Configuration data will be kept in XML/text/binary format, I have no problem with handling such files. I want to know where can I keep them. For example, in the Windows OS configuration data may be kept in the Registry (old way) or in user application data directory. What about Linux? I need read/write access to configuration files. 回答1: The concept of the registry is peculiar to Windows,

How to intergrate PDF viewer(display) in the GTK+ interface

Deadly 提交于 2021-02-18 19:16:47
问题 Am working on the project in which am required to fetch files from the server and to display them on the client post.All of this is to be done in the UNIX environment where I used C language for coding client and server and GTK+ for the interface which will display files in the PDF format. My problem is I do not know how can I intergrate a PDF viewer in such interface. As the final results I would like when I select the file and click GTKbutton it displays the file in a PDF format in that

Unix: What happens when a read file descriptor closes while calling select()

白昼怎懂夜的黑 提交于 2021-02-18 10:42:14
问题 Say that I call select() on a FD_SET containing a bunch of read file descriptors. What happens if during the select() call, one of the file descriptor closes? Assuming that some sort of error occurs, then is it my responsibility to find and remove the closed file descriptor from the set? 回答1: I don't believe this is specified anywhere; some systems may immediately return from select while others may continue blocking. Note that the only way this can happen is in a multi-threaded process

How can I tell if a makefile is being run from an interactive shell?

两盒软妹~` 提交于 2021-02-18 10:41:08
问题 I have a makefile which runs commands that can take a while. I'd like those commands to be chatty if the build is initiated from an interactive shell but quieter if not (specifically, by cron). Something along the lines of (pseudocode): foo_opts = -a -b -c if (make was invoked from an interactive shell): foo_opts += --verbose all: bar baz foo $(foo_opts) This is GNU make. If the specifics of what I'm doing matter, I can edit the question. 回答1: It isn't strictly determining whether it is

executing a script which runs even if i log off

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-18 08:23:08
问题 So, I have a long running script (of order few days) say execute.sh which I am planning to execute on a server on which I have a user account... Now, I want to execute this script so that it runs forever even if I logoff or disconnect from the server?? How do i do that? THanks 回答1: You have a couple of choices. The most basic would be to use nohup : nohup ./execute.sh nohup executes the command as a child process and detaches from terminal and continues running if it receives SIGHUP . This

behavior of parent and child for a signal handler

我的未来我决定 提交于 2021-02-17 21:39:38
问题 A process has a 'fork' call after a signal handler has been registered [for SIGINT]. what happens when SIGINT is sent through command line ? whether parent gets exited or child or both ? parent and child both are running infinite while loops. 回答1: If you do fork (without further exec* ) after a signal handler has been registered, the same signal handler will be used in parent and child processes. That is, if you do something other than exit in your SIGINT handler, neither parent nor child