linux

Writing output from a socket

I have 2 machines A and B. In machine A, I do echo "Hello World" > /dev/tcp/{Bs_ip}/12345 In machine B, how do I write a script that runs in the background, listens on port 12345, and prints whatever it receives from port 12345 to stdout? BTW both machines are running Red Hat Enterprise Linux AS 4. Thanks ...

is there a subversion web client that I can use

I want to install a svn web client on Linux (preferred) or Windows. I need only read-only capabilities (no commit required) and I want to be able to compare revisions using diff. my svn server is on another machine so the web server needs to access it over http. It should also be free... Do you know any such web client? ...

in_addr_t to string

Hello, I have an IP address stored in in_addr_t and I want to create the string representation of this data type, ie in_addr_t to 10.0.0.1. How can I do that? ...

How to compare the size of two directories?

I want to compare the total size of two directories dir1 and dir2 on different file-systems so that if diff -r dir1 dir2 returns 0 then the total sizes will be equal. The du command returns the disk usage, and its option --apparent-size doesn't solve the problem. I now use something like find dir1 ! -type d |xargs wc -c |tail -1 to k...

Linux display ipaddres before logon

Hi We build software running on Linux servers (Centos) We don't want the customer to have access to the Linux server, but the customer sometimes need to know the ipaddress of the server. So my question is: Is it possible to display the ipaddress at the loginscreen (no graphical interface), that means, before the user has logged in? M...

Find a file and open it for editing. How to do it fast in a bash shell ?

I face many times this simple and repetitive task configuring the LAMP or some stuff in Ubuntu or Drupal: I have to edit a config file (php.ini, httpd.conf, ... whatever) so quite frequently, if I don't remember the path by heart, I run these 2 commands: locate php.ini ------- typing manually one of the paths that are shown in the list...

Determining CPU utilization

Is there a command or any other way to get the current or average CPU utilization (for a multi-processor environment) in Linux? I am using embedded Linux in a small system. Basically, I need to determine the CPU utilization, so that if it is high, I can instead divert a new process to another controller in the system, rather than execut...

How can I draw a selection rectangle on the screen with Qt?

Hello, How can I draw a selection rectangle on my screen with Qt in X11? I want to be able to drag a rectangle on my screen (outside of the application) and then save the whole rectangle. Thanks in advance. ...

How i can find out which is the latest revision number in the repository?

How i can find out which is the latest revision number in the repository? ...

xargs with multiple arguments

I have a source input, input.txt a.txt b.txt c.txt I want to feed these input into a program as the following: my-program --file=a.txt --file=b.txt --file=c.txt So I try to use xargs, but with no luck. cat input.txt | xargs -i echo "my-program --file"{} It gives my-program --file=a.txt my-program --file=b.txt my-program --file=...

passing a location of build.xml in ant

I'm trying to run a script that uses an ANT build but I don't want to have to run it from the location where my build.xml file is. Is there a way to pass the location to ant? Thanks in advanced ...

Can I instruct gdb to run commands in response to SIGTRAP?

I'm debugging a reference leak in a GObject-based application. GObject has a simple built-in mechanism to help with such matters: you can set the g_trap_object_ref variable in gobject.c to the object that you care about, and then every ref or unref of that object will hit a breakpoint instruction (via G_BREAKPOINT()). So sure enough, th...

case insensitive search for file(s) with "string" somewhere in the filename linux

right now, all I know to use is: find / -name string.* that is case sensitive and it won't find files named: 1string.x STRing.x string1.x How can I search so that all the above would be returned in the search? ...

Reopen connected datagram socket

I have a connection protocol that has been defined by our customer. Data are sent between two linux computers using UDP and TCP protocols. The IP addresses and ports are fixed on startup. We are sending messages at 200 Hz and I have been using connect to save some time on the transmissions. My problem is that if there is a communicatio...

Does cronjob timing start from the moment it's created or is it preset?

I'm setting up a cronjob to run every 30 minutes on a Linux server. When does the 30 minute countdown start? Is it counted from the minute I created the cronjob or is it based on a preset 30 minute schedule? For example: If I create a cronjob at 9:32, set to run every 30 minutes, will it run at 9:32, 10:02, 10:32, 11:02... Or is ther...

How can I enable ctrl-c / ctrl+break after calling system?

I have written a program that invokes a system command from inside: #include <stdlib.h> int main(void) { while(1) { system("ls 2>&1 1>/dev/null"); // comment this line out to enable ctrl+break } return 0; } However, when it is running, CTRL+C and CTRL+BREAK no longer work and appear to be ignored. I am tryin...

add a child to GtkVBox

Hi, I have problem while adding a child to a GtkVBox. The VBox is inside a GtkViewPort which is inside a ScrolledWindows. After the child it's added using gtk_box_pack_end I check if it's really added checking the GLIST and it appears that it's added. Although visually anything appears and the scrolled window gets really big. Like if...

how to implement logic for my download button

Hi I want to know how to implement logic for my download button in PHP. I have a file in web server and have a page with download button. I want to start download a file when user press download button. How to implenent? Thanks ...

Linux command line SHA-256 hash different from online tools?

I was looking for a quick way to compute the SHA-256 hash of a password so I could upload some test data into a database that we are using Spring Security to authenticate against. First I found the linux utility sha256sum and ran it again the password "admin" and got this result: fc8252c8dc55839967c58b9ad755a59b61b67c13227ddae4bd3f78a3...

Which video codec should i use for generating my videos with OpenCV?

Hello, i am developing an application using opencv that manages a set of jpg images (user specifies the folder) and generates a video chronoconically based on EXIF date. my application must fullfilth the condition: 1) allow any fps value passed by user as parameter (any value between 1 and 100). at the moment i choosed the CV_FOURCC('...