I have a PHP script which executes a shell command:
$handle = popen('python last', 'r');
$read = fread($handle, 4096);
print_r($read);
pclose($handle);
I echo the output of the shell output. When I run this in the command I get something like this:
[root@localhost tester]# python last
[last] ZVZX-W3vo9I: Downloading video webpage
[la...
I am interested in writing utf-8 encoded strings to a file.
I did this with low level functions open() and write().
In the first place I set the locale to a utf-8 aware character set with
setlocale("LC_ALL", "de_DE.utf8").
But the resulting file does not contain utf-8 characters, only iso8859 encoded umlauts. What am I doing wrong?
Add...
I'm working on a deadlock detection algorithm and I'm only given kernel level libraries, i.e. #include <linux/somelibrary> and nothing else. Are there kernel-level facilities that will allow me to get the pid of the current process similar to getpid() of unistd.h?
...
Hello,
I am very new to screen and I have hit C-Something instead of C-a. Now I cannot detach or do any other commands. What can I do to detatch my screen session?
Thank you.
...
On a Linux box, I need to display the average CPU utilisation per hour for the last week. Is that information logged somewhere? Or do I need to write a script that wakes up every 15 minutes to copy /proc/loadavg to a logfile?
EDIT: I'm not allowed to use any tools other than those that come with Linux.
...
I've been slowly using my mouse less and less over the past few years. As a developer who prefers the command line over IDE bloat: the less I move from my keyboard, the more productive I tend to be.
So, a few days ago, I decided to do an experiment and unplug my mouse for the entire day. I definitely could have prepared myself bette...
On Gnome/KDE you can select in which application you want to open file (Right click on file -> Open With -> Other). Is it possible open file that way, but from console?
For example: you print " file.ext" and instead of opening in concrete application, there are that application selection window forced and then users chooses - starts sel...
If I type into a terminal,
export DISPLAY=:0.0
... where is the shell storing that environment variable?
I'm using Ubuntu 8.10. I've looked in the files ~/.profile and /etc/profile and can find no trace of DISPLAY.
...
I am working on a daemon that monitors file events via inotify to trigger various types of events when files are accessed. I have read that watches are a little expensive, because the Kernel is storing the full path name of every file being watched.
How many watches would be too many?
Edit: Mostly, I'm wondering .. have you ever seen a...
I can't get --random-sort to work with the sort command on a Fedora Linux-system.
Some context information:
$ cat /etc/fedora-release
Fedora release 7 (Moonshine)
$ which sort
/bin/sort
$ man sort | grep -A 2 '\-R'
-R, --random-sort
sort by random hash of keys
$ man sort | grep -A 3 '\-R'
-R, --random-sort
...
i would like to translate a following script from linux shell to Windows XP shell
GPSID=$(awk '/GPSID/ {print $3}' gora.RTK )
awk -v variable=${GPSID} 'BEGIN {printf "Numer seryjny : " variable,$1}' >>out.txt
The second line has been translated; the problem is with defining a variable that contains shell output in windows :-(
...
I'm putting some files in /tmp on a web server that are being used by a web application for a limited amount of time. If the files get left in the server's /tmp after the user quits using the application and this happens repeatedly, should i be concerned about the directory filling up? I read online that rebooting cleans out the /tmp dir...
I have a bunch of servers, on which I run experiments using screen. The procedure is the following :
ssh to server XXX
launch screen
start experiments in a few tabs
detach screen
disconnect from the server
While the experiments are running, I can easily find on which servers they are by sshing to all servers and listing my running pr...
I'm working on installing linux on a PS3 to do some development work and I've run across a bit of a snag. The current version of the firmware on my PS3 is 2.50. The Yellow Dog website specifically mentions that there are problems with this release. The official Yellow Dog install guide (PDF!) also mentions that I should update my PS3 to ...
I have a portion of a bash script that is getting a filename without extension, but I'm trying to understand what is really going on here. What are the "%%"'s for? Can someone elaborate on what bash is doing behind the scenes? How can this technique be used on a general basis?
#!/bin/bash
for src in *.tif
do
txt=${src%%.*}
...
Hi!
Under Windows there are some handy functions like QueryPerformanceCounter from mmsystem.h to create a high resolution timer.
Is there something similar for Linux?
...
Hello.
I've managed to get into a linux machine to try the HotKey library suggested in this answer.
I've compiled the sample code and now I run the program and I've got the following message:
[oracle@machine jxgrabkey-0.2.1_i386]$ java -classpath lib/JXGrabKey.jar:Example JXGrabKeyTest
Exception in thread "main" **java.lang.Unsatis...
Breadth-first list is important, here. Also, limiting the depth searched would be nice.
$ find . -type d
/foo
/foo/subfoo
/foo/subfoo/subsub
/foo/subfoo/subsub/subsubsub
/bar
/bar/subbar
$ find . -type d -depth
/foo/subfoo/subsub/subsubsub
/foo/subfoo/subsub
/foo/subfoo
/foo
/bar/subbar
/bar
$ < what goes here? >
/foo
/bar
/foo/subfoo...
sudo find /etc | xargs grep -i fedora > searchFedora
gives:
/etc/netplug.d/netplug: # At least on Fedora Core 1
...
But see the Fedora version in the /etc/netplug.d/netplug file. Is it serious?
...
How can I reach/install an old subversion package (v1.4.3) without build any sources ?
In fact, the distrib I use is not a FC1 but a "Red Hat Enterprise Linux AS release 4 (Nahant Update 5)".
Do you know some "subversion binaries repositories" where such a configuration may be available for download ?
...