Hi! Here's a short article of how to get going with Ubuntu server (9.10+, maybe works on older).
1. Download Ubuntu server http://www.ubuntu.com/getubuntu/download-server
2. Install, you may burn it on a CD or create an startup-USB with http://unetbootin.sourceforge.net/
3. Install! It's easy, just boot and chose install.
4. Update everything! Write the following in terminal:
sudo apt-get update
sudo apt-get upgrade
Now you're up and running! However it's not that fun to have an empty server! It's easy to install stuff however. For example, install apache, php and mysql: write "tasksel install lamp-server" in terminal. And phpmyadmin, write "sudo apt-get install phpmyadmin". Don't forget ssh-server, so you can login remotely: "sudo apt-get install openssh-server".
Why use Ubuntu (or other linux based server)? Well it's free, it's stable, it's secure and it ain't that hard. All info you need can be found on the internet, and the quality of diffrent tutorials and guides or just being better and better! Give it a try!
Here you find my solutions to diffrent technical problems. Secret comes from that it required much search on Google and much testing to acquire the solutions.
onsdag 7 april 2010
torsdag 1 april 2010
PHP 5.3 problems with references
Hi! I have recently updated to Ubuntu Lucid. With this I also got PHP 5.3.2. I thought it would be no problems updating PHP, but now after some hours for debugging I know I was wrong.
First I got a mysql SQLException (My own exception telling my about syntax error). And an warning:
Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a reference, value given in /var/www/bla/lib/classes/Database/MysqliStmt.class.php on line 68
This was confusing as SQL-syntax shouldn't change. It hadn't. I found that the SQLException was due to another query that returned nothing, and by this causing the other query to fail. The other problem with the warning was trickier. I have built an Database abstraction layer, and I'm using "call_user_func_array(array(&$stmt, 'bind_param'), $params);" in my mysqli-driver, on line 68.
This error was new, I have used my database abstraction layer several times on diffrent servers without any errors. I first tried to solve the problem by changing how $params is created.
From:
foreach($values as $value) {
$params[] = $value;
}
to:
foreach($values as $value) {
$params[] = &$value;
}
Problem solved, if my only aim was to get rid of warnings at least. I didn't get any results from my querys earlier, but now I still didn't get results but no errors or warnings either. When I printed out $params I could see that all values where the same, the last put into the array $params. Then after a while I realized what I was doing. "foreach" copies a value from $values to $value. If PHP is working with references (which 5.3.2 seems to do more), then I'm just placing references into $params to $value. And $value changes on every loop. This explains why all values in $params had the same value, the last entered into $params. The solution was to use this code:
for($i = 0; $i < $max; $i++) {
$params[$i+1] = &$values[$i];
}
Here I go thorugh $values. For each value in $values I put an reference into $params. The reference is pointing into the right position in the array $values.
First I got a mysql SQLException (My own exception telling my about syntax error). And an warning:
Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a reference, value given in /var/www/bla/lib/classes/Database/MysqliStmt.class.php on line 68
This was confusing as SQL-syntax shouldn't change. It hadn't. I found that the SQLException was due to another query that returned nothing, and by this causing the other query to fail. The other problem with the warning was trickier. I have built an Database abstraction layer, and I'm using "call_user_func_array(array(&$stmt, 'bind_param'), $params);" in my mysqli-driver, on line 68.
This error was new, I have used my database abstraction layer several times on diffrent servers without any errors. I first tried to solve the problem by changing how $params is created.
From:
foreach($values as $value) {
$params[] = $value;
}
to:
foreach($values as $value) {
$params[] = &$value;
}
Problem solved, if my only aim was to get rid of warnings at least. I didn't get any results from my querys earlier, but now I still didn't get results but no errors or warnings either. When I printed out $params I could see that all values where the same, the last put into the array $params. Then after a while I realized what I was doing. "foreach" copies a value from $values to $value. If PHP is working with references (which 5.3.2 seems to do more), then I'm just placing references into $params to $value. And $value changes on every loop. This explains why all values in $params had the same value, the last entered into $params. The solution was to use this code:
for($i = 0; $i < $max; $i++) {
$params[$i+1] = &$values[$i];
}
Here I go thorugh $values. For each value in $values I put an reference into $params. The reference is pointing into the right position in the array $values.
fredag 11 december 2009
Pulseaudio
Hi, I'm been testing different settings in pulseaudio. I wanted to disable upmixing from stereo to 4.1 as my amplifier does this. I also been investigating how the LFE channel works. I only have two stereo cables from my soundcard (meaning 4channels). So I wanted to route all bass to front-speakers, as my amplifier then automatically sends it to the subwoofer (at least it seems so).
I didn't succeed with what I wanted, but I did learn some things about pulseaudio. And got my audio to work pretty good, even if not exactly as I wanted. Now my system does remix audio from stereo to 4 channels (front-left,front-right,rear-left,rear-right). But the reason why this is enabled is that it also routes the center channel to front speakers.
Here's a summary of stuff that I want to remember next time I work with pulseaudio:
I didn't succeed with what I wanted, but I did learn some things about pulseaudio. And got my audio to work pretty good, even if not exactly as I wanted. Now my system does remix audio from stereo to 4 channels (front-left,front-right,rear-left,rear-right). But the reason why this is enabled is that it also routes the center channel to front speakers.
Here's a summary of stuff that I want to remember next time I work with pulseaudio:
- pavumeter:
- paman:
- /etc/pulse/daemon.conf: ... remix, channels (example)
- /etc/pulse/client.conf: ...autospawn...
- /etc/pulse/default.pa: ... sink, remap
- pulseaudio -k && pulseaudio --start
lördag 5 december 2009
Spaces in /etc/fstab
Hi! I just had a problem with spaces in a mountpoints name. While searching for solutions I found others who had problems with this, but in their case while trying to mount a network share. The solution can be found in the manual page for fstab (write "man fstab" in terminal).
Here's the text from fstabs manual:
And here's a working example that mounts "/dev/sdb1" (ntfs) into "/media/drive 2"
Here's the text from fstabs manual:
The second field, (fs_file), describes the mount point for the filesys‐
tem. For swap partitions, this field should be specified as `none'. If
the name of the mount point contains spaces these can be escaped as
`\040'.
And here's a working example that mounts "/dev/sdb1" (ntfs) into "/media/drive 2"
/dev/sdb1 /media/drive\0402 ntfs nls=iso8859-1,umask=000 0 0
söndag 22 november 2009
A look into the future - check out gnome-shell
I tried gnome-shell some days ago. I'm running it default on my laptop now actually. The design is intuitive and it is perfect for us that have several applications running at once and want to switch between all windows easily. It's very good-looking and allows you to work more effective than all others desktop managers I've tested.
If you're interested in what might be the beginning of a new GUI for operating systems, check out the official website: http://live.gnome.org/GnomeShell
If you wan't to install it, here's instructions for Ubuntu 9.10:
BTW if you run Fedora 12 you can enable gnome-shell by entering desktop effects and click on a button.
If you're interested in what might be the beginning of a new GUI for operating systems, check out the official website: http://live.gnome.org/GnomeShell
If you wan't to install it, here's instructions for Ubuntu 9.10:
- Start "Software sources" (find in menu or: alt+f2, write "gksu --desktop /usr/share/applications/software-properties.desktop /usr/bin/software-properties-gtk")
- Check "Community-maintained Open Source software (universe)" by clicking on it
- Click on close
- Open a terminal (alt+f2, write gnome-terminal)
- Write "sudo apt-get update" in the terminal
- Write "sudo apt-get install gnome-shell" in the terminal
- Now it's installed, just write "gnome-shell --replace" in the terminal to start it.
- System --> Preferences --> Startup applications
- Click on add, write "gnome-shell --replace" in the command field. Write what you want in the other fields.
BTW if you run Fedora 12 you can enable gnome-shell by entering desktop effects and click on a button.
Ubuntu 9.10 installation can't find my harddrive
Hi. I tried to install Ubuntu 9.10 a while ago. But in the partition manager within the installation software I couldn't find my hard drive. This was quite frustrating since I had no problems installing Ubuntu 9.04 (or older) and Ubuntu 9.10 did find my hard drive in GParted.
I think it's my motherboard that Ubuntu dosen't like. I have a Asus P5Q Pro (the hard drive is a Samsung 500GB SATA). However I did find a solution to this problem. Start the live-cd and do the following:
It should look like this when you're ready:
Now just save the file. Start the installation and your hard drive should be found. This worked for me at least. Of course you shouldn't do this if your hard drive actually is a part of a dmraid. In my case my hard drive was tagged as part of a dmraid falsely.
I'm actually a bit disappointed at Ubuntu 9.10 compared to Ubuntu 9.04. Ubuntu 9.10 doesn't boot sometimes, just hangs in the boot process and doesn't write any information about why. And it doesn't boot faster then Ubuntu 9.04, or at least it doesn't feel as it boots faster. However if it's working as it should (compatible hardware is used) it's very good. The sound configuration manager isn't even comparable with the old one, it's much better. Everything looks a bit nicer and it's very stable.
Use this solution (as all solutions I publish here) at your own risk. If you have critical data I wouldn't recommend you to try this solution without taking a backup.
I think it's my motherboard that Ubuntu dosen't like. I have a Asus P5Q Pro (the hard drive is a Samsung 500GB SATA). However I did find a solution to this problem. Start the live-cd and do the following:
- Cancel the installation (if you started it), shutdown the installation software (ubiquity)
- Open terminal (alt+f2; write gnome-terminal)
- Write "sudo gedit /lib/partman/init.d/30parted" in terminal
- Comment out the following:
# Skip devices that are part of a dmraid device
if type dmraid >/dev/null 2>&1 && \
dmraid -r -c >/dev/null 2>&1; then
if part_of_sataraid $device && \
[ -f /var/lib/disk-detect/activate_dmraid ]; then
continue
fi
fi
It should look like this when you're ready:
# # Skip devices that are part of a dmraid device
# if type dmraid >/dev/null 2>&1 && \
# dmraid -r -c >/dev/null 2>&1; then
# if part_of_sataraid $device && \
# [ -f /var/lib/disk-detect/activate_dmraid ]; then
# continue
# fi
# fi
Now just save the file. Start the installation and your hard drive should be found. This worked for me at least. Of course you shouldn't do this if your hard drive actually is a part of a dmraid. In my case my hard drive was tagged as part of a dmraid falsely.
I'm actually a bit disappointed at Ubuntu 9.10 compared to Ubuntu 9.04. Ubuntu 9.10 doesn't boot sometimes, just hangs in the boot process and doesn't write any information about why. And it doesn't boot faster then Ubuntu 9.04, or at least it doesn't feel as it boots faster. However if it's working as it should (compatible hardware is used) it's very good. The sound configuration manager isn't even comparable with the old one, it's much better. Everything looks a bit nicer and it's very stable.
Use this solution (as all solutions I publish here) at your own risk. If you have critical data I wouldn't recommend you to try this solution without taking a backup.
Hi
Hi. I just mention what the blog will be about here. I have thought for a while about writing down solutions to diffrent computer related problems, just so I remember how I did next time the problem occurs. Example of problems: Ubuntu can't find my harddrive; PHP isn't working; FFMPEG can't convert 3gp to flv; C is mean to me; Java do not obey my instructions and so on.
In short I will write about my solutions to diffrent technical problems, just to document the solutions.
BTW, English isn't my native language, just so you know, if you haven't noticed yet :)
In short I will write about my solutions to diffrent technical problems, just to document the solutions.
BTW, English isn't my native language, just so you know, if you haven't noticed yet :)
Prenumerera på:
Inlägg (Atom)