linux

Grep and Pipe in Linux

I have a giant file where I want to find a term "model". I want to pipe the first 5 lines containing the word model to another file. How do I do that using Linux commands? ...

How to listen UDP and make use of PHP

Hello, I have to build up a system which listens for requests from a GPS device which is only capable of sending UDP requests. Then I am going to analyze requests hopefully by PHP if it is possible. I do not know where to start. What do I need? Can I make use of PHP? Would it be reliable to use PHP? Can I just adjust Apache for listen...

how to get quotes in output in unix?

abc.dat file contains lines 1 2 3 code is tradeline="" for line in $(cat abc.dat) do tradeline="$line,$tradeline" done sample output am getting is 1,2,3, but i want the output as "1","2","3", can u help me plz ...

Is there a tool to create a countdown dialog box for the linux console?

I'm looking for dialog widgets for the Linux Console (not X, but the "terminal" console) that would show a countdown in seconds next to a widget that might be a menu list or a textbox. Ideally this might be a standalone program, like dialog, that is supplied parameters to control its behaviour. When the countdown reaches 0, the selecte...

Running the executable does nothing

Hi all, I was writing a sample example involving multiple files. The detailed code is as follows. main.cpp #include <algorithm> #include <iomanip> #include <ios> #include <iostream> #include <stdexcept> #include <string> #include <vector> #include "grade.h" #include "Student_Info.h" using std::cin; using std::cout; using std::domain...

How can I determine the current CPU utilization from the shell?

How can I determine the current CPU utilization from the shell in Linux? For example, I get the load average like so: cat /proc/loadavg Outputs: 0.18 0.48 0.46 4/234 30719 ...

How to send a html email with the bash command "sendmail"?

Anyone has a demo available? Sendmail is said to be not scalable,but it's free,so I decided to use it first for now:) ...

Haxe app and Gtk-WARNING on linux servers

Hi! I'm trying a Haxe-compiled solution called FAR (Flash Archiver) created by Edwin Van Rijkom (http://code.google.com/p/vanrijkom-flashlibs/) wich uses a command-line tool for creating compressed archives. When running the FAR tool locally on my ubuntu laptop, everything works fine. When running remotely (terminal as Root) on my Ubunt...

getutent and Linux timer issues

I have a problem running the below code , which invokes getutent() to count the total number of users currently logged in to the system. The timer will be invoked every 1sec and will set the boolean named "isSigAlrmOccured" to true and exit.The main function checks whether the timer signal is delivered by checking this boolen and monitor...

percentage difference between two text files

I know that I can use cmp, diff, etc to compare two files, but what I am looking for is a utility that gives me percentage difference between two files. if there is no such utility, any algorithm would do fine too. I have read about fuzzy programming, but I have not quite understand it. ...

How can I speed up a video by dropping frames?

I've got a video that's 30 minutes long. I want to make a speeded up version that's (say) 15 minutes long. I could do this by dropping every 2nd frame. How can I do this on linux? I'm playing with gstreamer and it looks cool. Is there a way to do this with gstreamer? What would be the gst-launch command line to do it? My source video i...

process is failing in ptrgl_64._ptrgl functionon aix

We are trying to port our code from HPX to AIX but getting core dump while running exe. its failing in some unknown function ptrgl_64._ptrgl. > ptrgl_64._ptrgl() at 0x900000084da0e48 > dfile_Proc(o_record = > 0x0000000400000004, fileType = > "^O\377\377\377\377\377TH^O\377\377\377\377\377TQ^O\377\377\377\377\377Ta^O\377\377\377\377\377...

Determine linux version from java

I'm wondering if there's a way to determine which version of Linux I'm running (ie differentiate between RHEL4, RHEL5) from within the JVM. I'm just looking for a consistent way to differentiate between the operating systems and their versions. ...

How to update a printed message in terminal without reprinting (Linux)

I want to make a progress bar for my terminal application that would work something like: [XXXXXXX ] which would give a visual indication of how much time there is left before the process completes. I know I can do something like printing more and more X's by adding them to the string and then simply printf, but that would lo...

Passing Array of objects Composed of other objects as reference to Functions In C++?

Hi all, I have a function which calls itself 10 times a second. I am using QTimer for repeat calls. void DisplayClass::UpdateGuiWithData() { //miscellaneous code which is validated SingletonObjectAsThread::instance()->UpdateFromGuiToExternalHardware(ClassOjbectArray,var1,var2); QTimer::singleShot(100,this,SLOT(UpdateGuiWithData())...

Can I remotely debug a linux machine from VS2005?

I am developing a cross-platform application in C++ in VS2005. I already know how to run a remote process on a windows box, attach it, and debug from my VS. Is there a way to do debug a running process on Linux for example? What about other *nix platforms such as Solaris or AIX? I can do emacs+gdb, but if this can be done from VS I'd pr...

How to get the system ioWait

How can i get the systems ioWait? This would be preferable by using info the /proc interface( i guess its written somewhere in there) so an app could detect this, but an external call to exec() from my app would be acceptable. ...

How to design Floating tool bar in Qt 4.5.2

How to make Floating tool bar in Qt, just like the top floating panel of Microsoft Windows RDP client, any code example? Regards ...

Login to a Linux server from a Windows system using batch files

Hello All , i want to make one script which will automatic telnet the system . I have to access from my system(Windows Xp) to my server(Linux) spawn telnet <machine ip> expect "login:" send "<username>\n" expect "Password:" send "<password>\n" Is the above script is correct? 1) If yes means, how can i access this script from my ...

Preventing delayed_job background jobs from consuming too much CPU on a single server

My Rails application has a number of tasks which are offloaded into background processes, such as image resizing and uploading to S3. I'm using delayed_job to manage these processes. These processes, particularly thumbnailing PDFs (using Ghostscript) and resizing images (using ImageMagick), are CPU intensive and often consume 100% CPU ...