What is the maximum number of characters that a user name or group name may be on Linux? I need to allocate a buffer and would like to know how much space I need to allocate to guarantee it is large enough for whatever group or user name my application might encounter. Answer (Putting my comment into an answer now
How to copy all files via FTP in rsync
I have online account with some Host which give me FTP account with username and password . i have another with copany which gave me FTP and rsync . Now i want to transfer all my files from old FTP to NEW FTP with rync. Now is it possible to do it via rsync only because i don’t want to
Sed – How to Print Regex Groups in Multi-Line?
Input file (test): Desired output: What I have done: Question: How do you print the regex groups in sed (multiline)? Answer If you use sed like this: then it will print in different lines: But is this what you are trying to print? Or you want to print text in hrefs? Update 1: To get hrefs between well formed <a
How to select the output device of audio in ubuntu manually?
In Ubuntu, we can select the output device of audio in sound preferences. But now I want to write a shell script, so I need to select the output device from the commandline. Answer You can first view your current default audio device by typing: And with you can view all your devices. And with this command you can set
Getting IP address from struct sockaddr doesn’t work for 32bit compilation
I have a small client/server app that sends/receives UDP discovery packets. When a UDP packet is received I want to display the source IP. The client/server code is based on the UDP example from Beej: https://beej.us/guide/bgnet/html/multi/clientserver.html When I compile for 64bit the IP is displayed as expected but when I compile for 32bit (-m32 option) it doesn’t get the right
eclipse/tomcat: deploy doesn’t work any more (ClassNotFoundException)
I’m running Eclipse Helios Service Release 1, with Tomcat 7.0.12 in Linux Ubuntu Natty Narwhal. I’ve been happily hot re-deploying my webapp until it stopped working for apparently no reason. The following exception is displayed: In Servers tab I’ve “Tomcat v7.0 Server at localhost [Started,Synchronized] My project appears as a child of Tomcat v7.0 Server In Properties, Java Build Path,
Pyaudio installation error – ‘command ‘gcc’ failed with exit status 1′
I’m running Ubuntu 11.04, Python 2.7.1 and wanted to install Pyaudio. So I ran, $ sudo easy_install pyaudio in the terminal and the process exited with following error messages, Searching for pyaudio Reading http://pypi.python.org/simple/pyaudio/ Reading http://people.csail.mit.edu/hubert/pyaudio/ Best match: pyaudio 0.2.4 Downloading http://people.csail.mit.edu/hubert/pyaudio/packages/pyaudio-0.2.4.tar.gz Processing pyaudio-0.2.4.tar.gz Running PyAudio-0.2.4/setup.py -q bdist_egg –dist-dir /tmp/easy_install-0Tetss/PyAudio-0.2.4/egg-dist-tmp-PYy9T8 In file included from /usr/include/python2.7/Python.h:8:0, from src/_portaudiomodule.c:30: /usr/include/python2.7/pyconfig.h:1155:0: warning: “_POSIX_C_SOURCE”
Accessing a mysql database from external host/ip? (ie: mysql workbench)
I have a mysql server running on x.x.x.x, and can access it internally no problem (of course). However when attempting to connect externally, ie using mysql workbench, or even from an external server, I get the error message “Host ‘bla.bla.bla’ is not allowed to connect to this MySQL server”. I have done: GRANT ALL PRIVILEGES ON *.* TO mysql@x.x.x.x IDENTIFIED
Linux programmatically up/down an interface kernel
What is the programmatic way of enabling or disabling an interface in kernel space? What should be done? Answer …by using IOCTL’s… … with the IFF_UP bit set or unset depending on whether you want bring the interface up or down accordingly, i.e.: Code copy-pasted from Linux networking documentation.
Tailing a file from where I left off before?
Suppose I have a file. I tail its last 10 lines and got some data. And the next time I come to tail, its length increases by 4. So I need to tail only that many lines to get data. Is there a simple command line for this? Like a mix of tail, wc, and grep? Answer If you save