LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-19-2018, 06:50 PM   #1
newbeliever
LQ Newbie
 
Registered: Jan 2011
Location: Iowa, United States
Distribution: Slackware
Posts: 21

Rep: Reputation: 0
Need advise on which Programming language would best fit this scenario.


I have a program I wrote in vb.net as console app for what I thought would be a short lived item. Now it must be a part of our daily routine.

Program must run like a stay resident app, watch a directory for a specific file type, read file data and manipulate the text data based on program variables, write new data to another location, then wait for another file.

I have Windows servers running and they would work but we have had issues with them hanging when we get busy. My Slackware 14.2 Samba box works and just keeps working. I want to utilize this system more as we have been slowly moving workflows over to open source alternatives.

What language would I want to use best for text manipulation in files that would stay resident on reboot of system. I know how to start scripts to load programs during reboot, if ever needed.

I have the time to learn a new language and currently my skill level needs some attention when development is concerned and I have been using Slackware for some time with Samba and such but never really wrote any program or scripts for something new in the Linux environment.

Thank you for any direction you may supply me.
 
Old 08-19-2018, 07:05 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
In Linux, a "resident app" is called a daemon.

What languages, if any, do you know?

My preference is to use perl, but I've been coding in it for several years. It's particularly good for text manipulation.

Just my two cents
 
1 members found this post helpful.
Old 08-19-2018, 08:43 PM   #3
newbeliever
LQ Newbie
 
Registered: Jan 2011
Location: Iowa, United States
Distribution: Slackware
Posts: 21

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by scasey View Post
In Linux, a "resident app" is called a daemon.

What languages, if any, do you know?

My preference is to use perl, but I've been coding in it for several years. It's particularly good for text manipulation.

Just my two cents
I have very basic knowledge of PHP, AWK, C++, Perl, Java. I have used extensively vb.net, turbo pascal V6(DOS), I am reasonably good at debugging and using assembly to break things, but I am relatively new at creating software to work; I have used Access to create databases used in production environments using VBA.

I used to use parts of what others have done and pieced it together for my own uses; but on this project I want to actually build from scratch to actually contribute a part of me, not a part of someone else for me. I have thought about using Perl, my only concern is how well it reacts with OS when watching for changes in a directory or would it be better to use something else, inotify maybe?
 
Old 08-19-2018, 08:50 PM   #4
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,900

Rep: Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050
Need advise on which Programming language would best fit this scenario.

Perl is the best for Text manipulation. Other options are python and ruby.
 
2 members found this post helpful.
Old 08-19-2018, 09:08 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
You should absolutely use inotify - from perl if you choose. You might not be surprised to learn you are not the first to need this. Check CPAN and I'd bet you'd find something like what you need on someones' blog.
Quote:
Originally Posted by newbeliever View Post
... watch a directory for a specific file type, read file data and manipulate the text data based on program variables, write new data to another location, then wait for another file.
This should be ok so long as you don't save changes to the source file - else you risk getting into a inotify loop/race.
 
1 members found this post helpful.
Old 08-19-2018, 09:34 PM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,222

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Honestly, from what you described, you can probably do it in BASH.
 
1 members found this post helpful.
Old 08-19-2018, 10:14 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by newbeliever View Post
I have Windows servers running and they would work but we have had issues with them hanging when we get busy.
Hmmm - no indication of what's making them busy, but I'd think bash might not be a great way of trying to sell Linux as the solution to the business suits if it's likely to get over-whelmed.
 
Old 08-20-2018, 03:16 AM   #8
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by newbeliever View Post
I have very basic knowledge of PHP, AWK, C++, Perl, Java. I have used extensively vb.net, turbo pascal V6(DOS), I am reasonably good at debugging and using assembly to break things, but I am relatively new at creating software to work; I have used Access to create databases used in production environments using VBA.

I used to use parts of what others have done and pieced it together for my own uses; but on this project I want to actually build from scratch to actually contribute a part of me, not a part of someone else for me. I have thought about using Perl, my only concern is how well it reacts with OS when watching for changes in a directory or would it be better to use something else, inotify maybe?
I once was hired to support and create software in a language I'd never heard of because of my background of supporting and creating software in other languages. The hiring manager's thought at the time (and mine now) is that programming languages are only different syntaxes to do the same thing...the important skill is to be able to think logically, and apply that to the development. It sounds like that's where you are.

If you choose perl, you'd best let go of "actually build from scratch." You can, of course do that, but
Quote:
The Comprehensive Perl Archive Network (CPAN) is a repository of over 250,000 software modules and accompanying documentation
so the odds are that whatever you want to do, someone has already done, and you should apply your skills to hooking all that available code together. It saves a LOT of time!

PS: I worked for that manager for five years, then worked with that language on two other jobs for a total of 13 years.

Last edited by scasey; 08-20-2018 at 03:20 AM.
 
Old 08-20-2018, 06:57 AM   #9
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by newbeliever View Post
I have a program I wrote in vb.net as console app for what I thought would be a short lived item.
Think back to when you did that originally in vb.net. What did you do? My guess is that you wrote something quick to "get it done" because it needed getting done, or you wrote a personal utility and then other people noticed and decided they'd like to use it. Now there are additional requirements. Great. But very similar approach as before, you write something in a language you feel would work for it and for you. No real magic here, just honest work.
Quote:
Originally Posted by scasey View Post
My preference is to use perl, but I've been coding in it for several years.
The point there is that it is perfectly fine to program in something you have experience with, but you can also extend your experience by doing newer things, or even using a similar language to what you've used in the past.
Quote:
Originally Posted by newbeliever View Post
I used to use parts of what others have done and pieced it together for my own uses
That's what a lot of initial programming turns out to be. Maybe not your entire project, but I'm betting that there are functional things you'll need to accomplish, like a sort, or linked list or something and you'll be able to find a wide variety of examples in various languages and scripts on the web.
Quote:
Originally Posted by scasey View Post
programming languages are only different syntaxes to do the same thing...the important skill is to be able to think logically, and apply that to the development.
Quite right! All the way down to assembly language. All these things do is read and write from memory and make decisions based on test criteria. The languages are just the things which give us tools to build upon the binary basis of the computer.


Since you feel you have time and license to learn, then explore a bit and decide for yourself. Rather than us recommend to you, how about starting with a language you've always felt that you'd like to learn?
 
1 members found this post helpful.
Old 08-20-2018, 08:52 AM   #10
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,222

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Quote:
Originally Posted by newbeliever View Post
vb.net
Hmm... vb.net?

Your program might actually be cross-platform. Try that first.

You know about the Mono Project, the monodevelop IDE, the open sourcing of .NET, and the Linux release of Visual Studio Code, right?
 
1 members found this post helpful.
Old 09-02-2018, 07:38 AM   #11
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Posts: 1,621
Blog Entries: 40

Rep: Reputation: Disabled
Text-manipulations and transformations of all kind are best done in an interpreted (script-) language. Not because these are more “powerful” or have an “adapted” syntax, but because of the nature of your project and the close resemblance of
* mastering language syntax
* mastering the syntax of in- and output

Bizarrely, even the “constructs” (intellectual and in terms of utilities) provided to achieve both are either resembling each other or identical...

For the same reason, the resulting code will be easier to maintain.

From my study of regular expression engines, I have to believe (cannot confirm anything), that Perl should still be the first choice. But, alas, I have as good as *NO* experience with Perl. Other script-languages have been sufficient for me.
 
1 members found this post helpful.
Old 09-05-2018, 11:08 AM   #12
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
inotify is great for local filesystems, but may have issues with network mounts. You might need to poll periodically.
 
1 members found this post helpful.
Old 09-07-2018, 03:39 AM   #13
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
Welcome to linux

You categorically do not need to do everything using 1 tool. In our culture generally you use one thing for one job and chain them together.


e.g: a little "daemon" that will wait for a file and then call another program:

Code:
while date; do

    for file in *
    do
        case "$file" in
            *.lis) echo do this to $file ;;
            *.x) echo do that to $file ;;
        esac
    done
sleep 3
done
You don't have to write a monolith to do the whole job as happens in the Windows world.
and you don't have to use the most esoteric tools when a simple script will often do.

You can start with simplicity, like above and make it more robust if you need to later.

Last edited by bigearsbilly; 09-07-2018 at 03:41 AM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Best language / solution for this scenario (web-ui & cli scripts exec) fruitwerks Programming 2 07-31-2010 06:21 AM
Advise on programming howto's Dutch Master Programming 9 06-13-2007 03:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration