LinuxQuestions.org latest posts

Syndicate content LinuxQuestions.org
LinuxQuestions.org offers a free Linux forum where Linux newbies can ask questions and Linux experts can offer advice. Topics include security, installation, networking and much more.
Updated: 24 min 56 sec ago

where to put headers and cpp files

36 min 42 sec ago
I have several classes that I use for multiple programs. Where should I keep the h/cpp files so I only have to add the #include for the compiler to find them?


Bash infinite loop problems?

48 min 6 sec ago
Hi Guys,
I seem to have a problem with with this bash script.I suspect that it has something to do with the infinite while loop.In addition to that the
array element also has incorrect syntax.
here is the code
please help
Thanks
--------------------------------------------------------
#1/bin/bash
clear
#set -x
IFS_OLD= $IFS

ans=$(zenity --list --text "please check all parameters for the Web page" --checklist --column "Pick" --column "Parameters" TRUE "title" TRUE "H1" TRUE "para1" TRUE "para2" TRUE "imageURL" \
--separator=":") ; echo "$ans"

IFS=':'

parray=""
arrAns=""
inc=0

for param in $ans
do
parray[$inc]=$param
inc= $(( inc++ ))
done

echo ${#parray[@]}

inc=1
while $inc -le ${#parray[@]}
do

while true
do
test_param= $(zenity --entry --text "Please enter ${#parray[$inc]} for the webpage")

if [ $? -eq 0 ] && [ -n "$test_param" ] ; then
arrAns["$inc"]= $test_param
inc= $(( inc++ ))
break
fi
done
done
#echo ${#arrAns[@]}
#EOF


Bash- :connot execute binary file

54 min 3 sec ago
Hi to all,

I have installed Ubuntu on one of my ESXI servers as a web server.

Yesterday i have been getting all errors on my system on boot.


and most of my commands do not work, such as "ls,chmod,netstat" and so on . the error is:

bash: /bin/ls cannot execute binary file.

FYI:
Kernel = 2.6.24-24-server #1 SMP Fri Sep 18 16:41:05 UTC 2009 x86_64 GNU/Linux

Thank you for your help.


LXer: Virtual Users/Domains With Postfix, MySQL, SquirrelMail (Mandriva 2010.0)

57 min 48 sec ago
Published at LXer:

This document describes how to install a Postfix mail server that is based on virtual users and domains, i.e. users and domains that are in a MySQL database. I'll also demonstrate the installation and configuration of Courier (Courier-POP3, Courier-IMAP), so that Courier can authenticate against the same MySQL database Postfix uses. The resulting Postfix server is capable of SMTP-AUTH and TLS and quota. Passwords are stored in encrypted form in the database. In addition to that, this tutorial covers the installation of Amavisd, SpamAssassin and ClamAV so that emails will be scanned for spam and viruses. I will also show how to install SquirrelMail as a webmail interface so that users can read and send emails and change their passwords.

Read More...


[PHP] connection to remote server to edit file

1 hour 13 min ago
I hope this is the correct subforum for my question. I'll give it a try.

I have a webGUI in php where users can make certain settings.
How can I edit a file on a remote server from my php webserver ?

Currently I use my FTP client, vsFTPd and a chrooted user in a specific directory where the file resides.

I think this is pretty save as long a nobody else uses my FTPclient.

How can I make changes to this file on the remote server from within my php-code on my webserver ?? (so that not I need to make the changes but my users can do it from a html-form)

I found this but the credentials for the FTP-connection are plain :

<?php
$file = fopen ("ftp://login:passwd@server", "w");
if (!$file) {
echo "<p>Unable to open remote file for writing.\n";
exit;
}
/* Write the data here. */
fwrite ($file, "blablabla");
fclose ($file);
?>

I use https for the webGUI, but I guess this does not mean the connection to the remote server will be encrypted also ?!

Has anyone a safe solution, some documentation on a certain technique that I can use ??

Can I use my FTP-user (has no shell) from within php to edit the file ?


ns-2.29

1 hour 13 min ago
i am simulating WSN scenario in ns-2.29 (patched with mannasim)
suppose energy of node is to be read at a particular time instant (say t=200s). how can i do that?
how to log energy in trace file at particular interval?


List of programs expected with Linux?

1 hour 18 min ago
I'm trying to develop an ultra-small distro for web serving, etc. I have something that will boot and access the drives, and I'd like to find a list of programs and libraries that are expected to be on a Linux/POSIX system (preferably one that tells where to obtain them) so I can make a usable distro. In addition, any advice about how to go about creating a distro would welcome.


How to turn off (spindown) SATA HDD on Debian after 10 min inactivity

1 hour 26 min ago
I wold like to know how to turn off (spindown) SATA HDD on Debian after 10 min inactivity (using a script).
I wold like to setup a NAS based on Debian. The NAS will be hallways ON but I want the NAS HDD to gos off after 10 of inactivity. When I access the NAS server the HDD should go back ON (after a small delay).

Thank you,


flashplugin-nonfree limitations

1 hour 56 min ago
On Debian Lenny 64-bit if you install flashplugin-nonfree it downloads the adobe package from adobe and installs it on your system. I know this from watching apt-get download each part from adobe.com. However flash does not work correctly in all locations. 90% of the stuf I try to view works fine, but occasionally I come across someplace where it does not work. My most recent discovery is hulu.com. I was bored and was going to catch up on some shows I missed but everytime I try to watch something I get the message "We're sorry but we're unable to stream videos to your system. this maybe due to an Adobe software limitation on 64-bit Linux systems."

I was just wondering, has anyone else seen this issue and is there a fix for it?


How to turn off (spindown) SATA HDD on Debian after 10 min inactivity

2 hours 15 min ago
I wold like to know how to turn off (spindown) SATA HDD on Debian after 10 min inactivity.
I wold like to setup a NAS based on Debian. The NAS will be hallways ON but I want the NAS HDD to gos off after 10 of inactivity. When I access the NAS server the HDD should go back ON (after a small delay).

Thank you,


can't get the syntax right in this pyqt3 command?

2 hours 17 min ago
Code:     x = self.spinbox37.value() * 40
          y = self.spinbox38.value() * 40
          printer = str(self.comboBox4.currentText())
          print_cmd = 'echo "IN;PU" x "," y | lpr -P %s %s'
          self.LCDNumber18.display(x)
          self.LCDNumber19.display(y)
          #print_cmd = 'echo "IN;PU2100,11300;" | lpr -P %s %s'
          os.system(print_cmd % (printer, "")) In the above line I'm trying to use the x and y variable set by the spinbox values, I just can't seem to get the variable value it keeps giving me a literal x and y in the print command. The commented out print command with the forced x and y works great.

Any ideas or help would be appreciated!


Problem in Firefox in F12

2 hours 18 min ago
Hello frnds, i recently installed fedora 12 freshly on my system. Later i installed firefox from fedora dvd. After it i install Adobe Flash 10.58 plugin to see videos or play games. But i m not able to do so. As firefox doesnt run video by flash player. I tried updating firefox. reinstalling firefox and adobe flash plugin but all in vain. Tell me frnds what should i do.HELP PLS


Looking for an alternative 'cleaner' solution

2 hours 25 min ago
Well i have the following script which takes as input parameter a webpage
and extract the emails from it.
The results are correct but i was wondering whether i could rewrite it
in a better, 'cleaner' manner.
I think my for loop is a bit ...primitive and also each email is printed
twice :redface:
Code: #!/bin/bash


echo $1

echo "The script starts now."

echo "Hi, $USER!"

wget $1 -O webpage.txt

awk '
{
  for (i=1;i<=NF;i++) {
      if ( $i ~ /[[:alpha:]]@[[:alpha:]]/ )  {
      print $i
      }
  }
}' webpage.txt My main concern is the part inside awk '{...}'
Any ideas ?


apt-get re-install-from-scratch-spare-nothing-no-excuses option

2 hours 25 min ago
In particular, this is with regards to freevo, but it applies to anything that can be obtained through apt-get.

How do i remove it, and re-install it, and start again from scratch? Time and again i do "apt-get delete blah", then "apt-get install blah", only to find it's exactly the same as it was in the first place, and still broken.

Why does this happen? How can i make sure everything is COMPLETELY GONE. I don't care about lost data, i don't care about lost config files, or anything. There is just one aim here - i want it to work again.

Can anyone help? Because this is driving me nuts. Fixing stuff is okay, but quite often the simplest course of action is to start again from the very beginning.

As for my freevo, i've read everything i can, i've done everything i can think of, i've even written to the developer, no reply. There's obviously a reason it doesn't work, but i'm past caring, i just want to start again from scratch.


Sort in descending order according to a column of an array

2 hours 30 min ago
Hello ! I have the following bash script:

Code: #!/bin/bash


echo "The script starts now."

echo "Hi, $USER!"


echo "Count of logins for each user:"
#!/bin/sh
last > logs.txt
awk '{count[$1]++}END{for(j in count) print j, "("count[j]"logins)"}' logs.txt What it does is count logins to my network and print on screen the total
of logins each user has.
How can I have my results in descending order according to the loggins of each user?
For example the result should be like:
ampaltas (80logins)
amaxilat (61logins)
altanis (70logins)
alkalai (70logins)
alexopo (20logins)
alexiou (18logins)
alexandz (17logins)
alavernt (11logins)
akribopo (11logins)
akretsis (10logins)
akis (2logins)
akatis (1logins)


Remote Desktop Fedora 10 and Windows 7

2 hours 38 min ago
How do i set up a remote desktop connection from my Windows 7 machine to a SFTP server im trying to set up running on Fedora 10.

Ive installed vnc server on fedora, and tried tightvnc and real vncviewer on windows and i cant get it to connect. Im not sure how the firewall works in fedora, but ive added the port to the "other ports" section of the firewall. On the windows firewall ive also added the vnc programs to the exception list.

Any help would be appreciated, thanks.


display issue of fonts with iceweasel and claws

2 hours 39 min ago
Hello. Some fonts or lettering produces gobble-di-gook rather than a proper display in both iceweasel and claws mail reader. Usually punctuation (like ") results in this. For instance, from the site Clean Debian Etch Install, I get the following:
Code: The ‘Choose country or region’ screen will appear, select ‘United States’ or your preferred country. I'm assuming the above should display as, Code: The "Choose country or region" screen will appear, select "United States" or your preferred country. Anyway I can fix this?


JTexrField needs to respond to drop - pls hlp

2 hours 40 min ago
Hi,

So, DnD is cool - and in Java, it works. Just set the component where the drag starts to allow that:

Quote: tblMain.setDragEnabled(true); and - yes - the rest pretty much runs itself. I have a JTextField that happily takes the drop from the JTable (be it the whole row - I'm not there yet, still working on that)...but does not raise any events.

I'd like the JTextField to raise an event:
- cleaning up the received data, now it gets the raw stuff, and I need an ID from that string
- starting up another void() with the received ID

I read the tutorials but - for blisters - cannot see the "light", please shed some (light, that is) :D

Tnx!!

Thor


sound card not being recognized

2 hours 44 min ago
Trying to get sound to work with LENNY.

lspci | grep audio shows a cirrus logic CS4614/22/24/30 sound card, but running alsaconf does not find the card. I added my user name to the audio group but still nothing.

Running alsamixergui give an error (no surprise there): "Function snd-ctl-open failed for default. No such file or directory."

The volume control icon at the top of the screen has a red X and when you click it it says: "No volume control GStreamer plugins and/or devices found."

How do I give Lenny a voice?


to mount external drives on startup

2 hours 48 min ago
I want all my external drives mounted when I start OS.

I don't want to do it for a specific external drive. I want my external drives mounted by default.

Do you have an idea? Does linux have such a configuration I can change?
Or do I have to write a script?