System Programming





Kernel and system programming is the process of creating the software necessary for a computer or device to function and operate other programs. Some operating systems (such as Microsoft Windows) are proprietary, but others, such as the various Linux distributions, are open source.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi I need help in converting a MFC application to a console application. I read that you can pass command line arguments through a customized CCommandLineInfo, but I'm not sure how to go about it.
The current application is a CRC calculator. I want to be able to pass what files it takes to use for the calculations if possible.
I attached a copy of the cpp file if that helps.

Any feedback will be much appreciated.
Hi Experts,

How do I setup a task in Task Scheduler that should not be PWD depended?

Also I would like to receive an email if the task didn't run successfully.

I want to log all rysylog I configure and everything is fine.
I create a new template that is:
template(name="stdSQLformat" type="string" option.sql="on" string="insert into SystemEvents (Message, Message2, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values ('%msg%','%msg:R,ERE,0,DFLT,1:([0-9]+\.){3}[0-9]+[:]?([0-9]+)?"--end%', %syslogfacility%, '%HOSTNAME%', %syslogpriority%, '%timereported:::date-mysql%', '%timegenerated:::date-mysql%', %iut%, '%syslogtag%')")
but when I run rsyslog I get:
error during parsing file /etc/rsyslog.d/mysql.conf, on or before line 8: invalid character '"' in object definit
I know that the problem is with
but I don't understand what I have to do !
I have rsyslog that is save data in my sql,
I want to save a mirkotik hotsport logs in specifc table named mikrotik
the log in general is like:
Jan/03/2020 10:20:20 hotspot,debug hotspot: mfs ( sending RADIUS authentication request
Jan/03/2020 10:20:20 hotspot,debug hotspot: mfs ( Access-Accept from RADIUS
Jan/03/2020 10:20:20 hotspot,debug hotspot: mfs ( using profile <default>
Jan/03/2020 10:20:20 hotspot,debug hotspot: mfs ( adding ip->user binding
Jan/03/2020 10:20:20 hotspot,account,info,debug hotspot: mfs ( logged in
Jan/03/2020 10:20:20 hotspot,debug hotspot: mfs ( sending RADIUS accounting Start request
Jan/03/2020 10:20:20 hotspot,debug hotspot: mfs ( RADIUS accounting request sent
Jan/03/2020 10:31:12 hotspot,debug hotspot: hotspot1: new host detected 64:D1:54:D7:DC:48/ by UDP :20552 ->
Jan/03/2020 10:31:12 hotspot,debug hotspot: hotspot1: dynamic host 64:D1:54:D7:DC:48/ added, ip
Jan/03/2020 10:47:06 hotspot,info,debug hotspot:  ha ( trying to log in by https
Jan/03/2020 10:47:06 hotspot,debug hotspot:  ha ( local user not found
Jan/03/2020 10:47:06 hotspot,debug hotspot:  ha ( sending RADIUS authentication request
Jan/03/2020 10:47:08 hotspot,info,debug hotspot:  ha ( login failed: RADIUS server is

Open in new window


I must use an old Isapi dll 32 bits wrtten with Delphi7
-> is it useful to adapt it in 64 bits mode
-> which tool can I use for doing this

Thanks in advance
Trying to accomplish the following, oBdA provided me with the process script, but I'd like to build on it.  If anyone can help, it would be greatly appreciated!

Have a powershell script that can be called from a vbscript and pass the parameter defined in the vbscript to the powershell script. In vbscript, I can call with this code, but not sure how to pass the parameter (computer) for example defined in vbscript...
'Set objShell = CreateObject("Wscript.Shell")
'Objshell.Run("powershell.exe -noexit .\test.ps1")

Open in new window

Powershell Script I'd like to do a few things:
• Check if the computer is online or offline.
• if computer is is offline, exit and send an email
• if the computer is online, run the below script that will check for running processes.
• if the below has anything other than return code 0 (meaning process is still running), have send email
• if the below has a return code of 0 (meaning no processing running), run an executable and invoke some SCCM commands.
 $computerName = 'RemoteMachine' ## Set to $null to run locally
$processList = @'
    "Name",             "Expected",     "Running"
    "cmd",              "1",            "0"
    "powershell",       "1",            "0"
    "OfficeClickToRun", "2",            "0"
'@ | ConvertFrom-Csv | ForEach-Object {$_.Expected = [int]$_.Expected; $_}

$splat = @{}
If ($computerName) {
    $splat['ComputerName'] = $computerName
    Write-Host "Testing processes on $($computerName)" -ForegroundColor Yellow

Open in new window


   I have called third-party  api from main thread in c++ on linux which is working fine as expected. But, when I call same api from child thread, it's failing in multi threaded application.

   technically what could be the reason? (not interested to check with third-party people).

tried to intercept exttextoutw and tired of hangs

so coded a memory dumper but prices of financial quotes - unpropiable

wanted to code superfast signaller to forex few years ago

and if autosubscribtion eats all my salary for this month - may be anybody helps me to fullfill my interest with valueable advices of methods how can I know prices in the exchange soft
Robocopy question

Currently I have a .bat file that uses robocopy to copy specific files from one folder to another.  Easy and it works just fine.

Issue now is the files are coming to us in multiple folders with date and timestamp.  What we need to is just copy the files within those folders to another location without copying the actual folders.


@Echo off


Again files were saved within folder "file3".  However, now there are multiple folders within "file3" and we need to pull just the files from within those subfolders but all the folders have different date and timestamps


@Echo off

D:\file1\file2\file3\Folder_test_072519 (where date changes everyday)

Is there anyway to do this?

  aws efs mounted (nfs 4) on rhel 7.4.  On my machine, I have ~10 mounts. How do I find whether it is efs mounted from us-east-1 or other mounts?  Is there any function or systemcall to find out from c or c++? Already tried with statvfs and statfs calls.

What would you say are some of the best practices when it comes to securing your system(s) against dependencies (any you can think of) to enable continuous access and delivery to/of data.

Do we need to replicate things that much between servers/countries, what would be alternative approaches?

I am thinking in concepts of things like: security, cloud, blockchains, messaging and whatever you have in mind.
Hello all,

I hosting a hackathon event and I need some ideas for a t-shirt that will be given to the winning "crowd" favorite team. There are 1st, 2nd, and 3rd prizes (judged by an executive committee), but I added an additional award for all the participants to have their own say.

I need a t-shirt that is relevant to this group of Scala programmers. However, I am not immersed enough in coding and Scala to determine what isn't stupid/cheesy, but genuinely funny or "oh so true".

A few other facts that may give context:
- It a hard working group of about 200 developers
- Largely coding in Scala on Macs and Ubuntu  - WHAT? Scala is a rejected topic by EE??
- Our product is designed for the business enterprise market

Any suggestions are appreciated. They can be as actual t-shirt examples, a graphic, or a quote that I can use to make my own.

Thank you :)

  compiling xerces on solaris box.
  /usr/lib/sparcv9/ and /usr/lib/64 have libicu*54.  
  In another location, /icu_needs_to_build_with/libicu*44.
  Whenver I compile, it's always picking libicu*54 version. I do want to build xerces with libicu*44 libraries.
  Do we have any flags like LDFLAGS or xyz to configure specific version shared libs?
Dear Experts, is there any tool or code which we can use to block some ports of applications. For example: someone inside LAN network can block the communication between Exchange servers and normal PCs?

Also, is there any tool/code which can be used to track the Internet access of VPN user?

And which tool should we use to mitigate it?

Many thanks!
visio 2013 standard does not show the "UML Sequence" template as shown below
only professional viso 2013 shows it?
are there existing sample diagrams which i can use as sample and modify on top of them easily?
any alternate tool to draw these type of diagrams easily apart from visio like free open source tools?
Please advise
In Enterprise Architect, how do you turn functional requirements into use cases?

I have tried to open the Relationship Matrix and then added use cases through it. But it seems like that is not the intended process.

The process I am looking for will be smooth.

I have requirements that I need to put into requirement groups. Then use cases I need to put into use case groups. The system is rather big.
Can you guide me to any example where EA is used and has the full tracebility of requirements to use cases, domain model, interfaces, and components?

I want to understand how to get from requirements to components, interfaces, and operations in EA
Hi Experts,
we have a site created in Caspio that has some required fields.
We realized that some of the required fields are coming thru w/o containing data.
So were told by Caspio that is probably due to those users using an old browser.
They created a field named user_agent that will capture which browser were used for each record data entry.
Now I created a list of all records with missing data in required field along with the data captured in this field named user_agent (browser).
See attached.
Wondering what are those values are and how can we sent a message informing this and this browser is not supported...

We need to regularly create system restore points on our user computers via command line.

The idea is to automate this process without deploying any 3rd party tools.

Step 1. Check if system restore is enabled on the computer. If it is not, enable it.
Step 2. Check the storage size allocated for system restore. If it is less than 6 GB, configure to to be 6 GB.
Step 3. Create a system restore point with a generic label e.g. "maintenance".
Step 4. Check if the system restore point got created or not by listing existing system restore points and comparing the labels with the generic label used in step3.

So this is the general idea of the script we want to create and I think I can do the other bits myself except for creating system restore point via command line.

I have tried the WMIC method, powershell method and everything else I can find on blogs and google search.

Most commands I run return the "execution successful" message.

But when I check manually if the system restore point got created or not by opening system restore GUI, I don't see the restore point created.

For the life of me I can't figure out what's going on.

So pls help !
What can be reason to the below error, while it only happens when I deployed the same project to https (everything is fine if I deploy it to http)?

Server Error in '/RegRec2' Application.
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.]
   System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper) +258
   System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +497
   System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +100

Open in new window

In short, I would say:

A flag is a predefined bit or bit sequence that holds a binary value.

A mode is a distinct setting.

So it's not always possible to replace the term "mode" by "flag". This is only possible if it's about a binary value. I got confused by these terms when reading:

The argument flags must include one of the following access modes:

The file creation flags are O_CLOEXEC,

The file status flags are all of the remaining flags listed

Why they just don't say:

The file access flags are O_RDONLY, O_WRONLY, and O_RDWR.

Why they suddenly use a different term when it's about "access"? Probably behind the scenes it's also just about a binary value, right? Probably all O_VARIABLE's above are 0 or 1.

And see:

This table records the mode with which the file (or other resource) has been opened: for reading, writing, appending, and possibly other modes.

So Wikipedia uses the term "mode" only (and not flag). At least they are consistent, because they call them all "modes".

Is there a specific reason why sometimes mode is used and something flag (while it's about the same thing)? I would stay, be at least consistent to avoid confusion.
By default, the first three rows of a "file descriptor table" consists of:

FD 0 (standard input,  associated with keyboard)
FD 1 (standard output, associated with screen)
FD 2 (standard error,  associated with screen)

Open in new window

These file descriptors point to one or more rows in the "open file table". Imagine we only have these three file descriptors. Then how does the "open file table" look like?

Usually all three file descriptors point to the same file, but that doesn't mean they point to the same entry in the "open file table". So how the open file table looks like?

_ | offset | reference count | permissions | flags | pointers
_ |    ?   |        ?        |      ?      |   ?
possible more rows

Open in new window

The lsof command shows for example:

lsof        721    root    0u      CHR              136,1       0t0          4 /dev/pts/1
lsof        721    root    1u      CHR              136,1       0t0          4 /dev/pts/1
lsof        721    root    2u      CHR              136,1       0t0          4 /dev/pts/1

Open in new window

The file "/dev/pts/1" is CHR (character special file). They all point to the same file.
I'm also wondering why it's for example "0u" and not "0r"? The file descriptor 0 stands for input, so it only has to read something.

r for read access;
w for write access;
u for read and write access;

Open in new window

I would expect something like: 0r, 1w, 2w instead of 0u, 1u, 2u? And what are the offsets et cetera?

i have script working.
When it runs it check for files and send email alert if not files and also if has files.
Currently it sending the email alerts text format.
Request experts help, want to send email with htm format.
and for errors it should bold the text and color RED.
can help...

#Requires -version 3.0
function Send-Mail
  param (
    [string] $Email_Subject,
    [string] $Email_Body,
    [string] $Email_Attachment
  Send-MailMessage -SmtpServer '' `
  -Body $Email_Body `
  -From '' `
  -To '' `
  -Subject $Email_Subject `
  -Attachments $Email_Attachment
function Send-Error
  Write-Host "Sending Error Alert @ $emaildate"
  $subject = "ACTION REQUIRED : Error Alert @ $emaildate"
  $logcontents = get-content $Logfile | Out-String
  $Body = "Dear All,`n`nThis email sent by system for errors highlighted below."  + $logcontents + "`n Regards,`n Job Process"
  Send-Mail -Email_Subject $subject -Email_Body $Body -Email_Attachment $Logfile }
function send-status
  Write-Host "Sending Success Alert @ $emaildate"
  $subject = "INFO : Success Alert @ $emaildate"
  $logcontents = get-content $Logfile | Out-String
  $Body = "Dear All,`n`nThis email sent by system for your information"  + $logcontents + "`n Regards,`n Job Process"
  Send-Mail -Email_Subject $subject -Email_Body $Body -Email_Attachment $Logfile }

  #check if source files exists
I am trying ssh into a remote server, capturing the process ID, and stopping the app using the process ID.

For some reason I am loosing the value of the variable PROCESS in the SSH session,  all the logic works fine if i run it locally. Below is the code and the execution part where i am loosing the variable (PROCESS) Value. Can someone tell me why i am not able to capture the echo "$PROCESS" and $PROCESS below.

. /apps/web/properties/tomcat.props
for server in "${dev_host_Array[@]}"
        echo "connecting to the server $server" | tee -a /tmp/tomcat-App-operation.${now}.txt
        ssh -q "$server" bash -c "'
         PROCESS=`ps -ef | grep $app_name | grep -v "grep" | grep -v "" | awk '{print $2}'`
         echo "$PROCESS"
      if [ ! -x $PROCESS ]; then
         /apps/tomcat/$app_name/bin/ stop | tee -a /tmp/tomcat-App-operation.${now}.txt &
         declare -i elapsed=0
           while ps -p ${pid} >/dev/null; do
            sleep 1
             if ((++elapsed % 60 == 0)); then
               kill -9 $process
   echo " TOMCAT $app_name is already in stopped state"


+ for server in '"${dev_host_Array[@]}"'
+ tee -a /tmp/tomcat-App-operation.1536692015.txt
+ echo 'connecting to the server testserver1'
connecting to the server testserver1
++ ps -ef
++ grep -v
++ awk '{print $2}'
++ grep …
I have to migrate the FS GPFS (3.4) on AIX server on new NSD disks, under the current configuration.
Which replication procedure is best to use?

[root@crmcas01]/tmp# mmlsconfig
Configuration data for cluster TEST:
myNodeConfigNumber 1
clusterName TEST
clusterId 13882357993337224079
autoload yes
dmapiFileHandleSize 32
tiebreakerDisks tiebreaker01
worker1Threads 500
traceRecycle global
tracedevBufferSize 1048576
traceFileSize 300000000
trace all 4 tm 2 thread 1 mutex 1 vnode 5 ksvfs 2 klockl 2 io 3 pgalloc 1 mb 1 lock 2 fsck 3
pagepool 8G
nfsPrefetchStrategy 1
maxMBpS 2048
maxStatCache 256000
maxFilesToCache 64000
adminMode allToAll

File systems in cluster TEST:
I have a requirement for an excel sheet to be formatted from a flat structure to a stacked structure. I'll try to explain:
In the flat structure has a number of basic columns, some of these columns repeat multiple times ('Transaction1', 'Transaction2', 'Transaction3'). some of the items will not have all transaction data, therefore some of those columns may be blank for a given item.

Example -

I need to take this data structure and transform it in another sheet/workbook so it goes like this. The transaction is a single column with the transaction1,2,3 data repeating as row beneath the item, all other columns will remain blank. The next item will begin on the next available blank row.

Example -


System Programming





Kernel and system programming is the process of creating the software necessary for a computer or device to function and operate other programs. Some operating systems (such as Microsoft Windows) are proprietary, but others, such as the various Linux distributions, are open source.