If you receive a file with 7z extension, it means the file is compressed using 7zip approach. The decoder is not available by default on Ubuntu.
So you need to install p7zip-full in order to be able to decompress it with the command: p7zip x file.7z
I always forget the tricks I use for software installation or configuration. I will use this blog as a reminder.
Friday, June 8, 2012
Tuesday, June 5, 2012
Install magento on Ubuntu
- Download The latest version of magenta on: http://www.magentocommerce.com/
- Install zend: sudo apt-get install zend-framework
- Decompress the tar.gz file from magento you downloaded and copy it on /var/www/data
- Change the owner of the magento folder: sudo chown -R www-data /var/www/data
- Install addiditional libraries needed by magento: sudo apt-get install php5-gd php5-curl php5-mcrypt php5-mysql
- Restart apache to make sure the changes are applied: sudo /etc/init.d/apache2 restart
- Magento should be properly installed: go on http://127.0.0.1/magento and fill the wizard
You should arrive to a page asking for mysql credentials. if you did not install them already, follow these steps:
- sudo apt-get install mysql-server
- Follow the instructions and set the root password to the database
- Run mysql script: mysql --user=root --password=XXXX where XXXX is the password you specified in previous step
- Create the magento schema: create schema magento;
- Exit the script: exit;
Note: This is by no mean a production environment installation. It is just a technique to have the server up and running.
Tuesday, May 29, 2012
double conversion with GWT
During my photogrammetry project, I worked with java that was converted into javavascript with GWT and I found an interesting optimization to convert double into integers.
The three first items are well known and are common java. However as the project is compiled in javascript, we can use javascript specific language that can provide interesting options:
To convert a double into an int, there exists multiple approaches:
- Cast to int
- Math.floor
- Math.round()
- ~~x
- x | 0
- "~~x" will do a 2 binary not operations on the natural part of x. In other words, not(not(x)) will return the content of the natural part of x.
- "x | 0" will do a logical of the natural part of x with 0. In other words, or(x,0) will return the natural part of x.
Be aware that these functions only work if x is greater or equal to 0...
It seems pretty trivial, however, we can see here: http://jsperf.com/math-floor-vs-math-round-vs-parseint/39 that running ~~x or x|0 is often faster than Math.floor(x)...
You will ask how to perform such javascript trick in GWT: for this, we must use JSNI:
private static native int floor(double x) /*-{return ~~x;}-*/;
Monday, May 21, 2012
Listen on every interface with GAE
Add the line -a 0.0.0.0 on the server parameters and the server will listen not only on localhost but on all the interfaces.
Wednesday, May 9, 2012
apt-file is your friend
Have you ever wondered in which package a library was provided? I did.
Usually, I looked on google to understand in which package the file was located and often I finished with 5 packages installed whereas only one was needed. To solve this problem, apt-file exists:
The result is the following:
What does it mean? It means that 2 packages have the expected file: the first one is called libann-dev (What a surprise!) and the file I am looking for would be (when installed) in /usr/include/ANN/ANN.h. The second one is called libmadlib-dev and the file would be in: /usr/include/MAdLib/ANN.h
Usually, I looked on google to understand in which package the file was located and often I finished with 5 packages installed whereas only one was needed. To solve this problem, apt-file exists:
- First install it: sudo apt-get install apt-file
- Then, update it's database so that all the information is fetched in the repository:
sudo apt-file update
apt-file search ANN.h
The result is the following:
libann-dev: /usr/include/ANN/ANN.h libmadlib-dev: /usr/include/MAdLib/ANN.h
What does it mean? It means that 2 packages have the expected file: the first one is called libann-dev (What a surprise!) and the file I am looking for would be (when installed) in /usr/include/ANN/ANN.h. The second one is called libmadlib-dev and the file would be in: /usr/include/MAdLib/ANN.h
Sunday, May 6, 2012
How to check a jpg is corrupted?
The best way to analyze if a jpeg is not corrupted is to open it, but some times, it happens, that you have a bunch of files to check.
To perform it, you can run jpeginfo which will display an error message if there is a problem. To find all the images:
A small explanation is needed here:
In my case, the images were automatically generated so I do not care and I would actually love to delete them:
To perform it, you can run jpeginfo which will display an error message if there is a problem. To find all the images:
find . -name "*jpg" -exec jpeginfo -c {} \; | grep -E "WARNING|ERROR"
A small explanation is needed here:
- find . -name "*.jpg" : we look in the current folder for all the files containing jpg extension
- For each of these images we run jpeginfo -c "filename" (filename is automatically replacing the the curly brackets)
- From the previous result, we get all the strings containing WARNING or ERROR. Be aware that if the file name contains this string, it will be displayed
In my case, the images were automatically generated so I do not care and I would actually love to delete them:
find . -name "*.jpg" -exec jpeginfo -c {} \; | grep -E "WARNING|ERROR" | awk '{print $1}' | xargs rm
In this command, we use the same result as before:
- but we take only the first item of each line (which is the filename)
- We remove all of them using: xargs rm
How to convert a video into frames?
That should be simple to convert a video into frames (and it is as soon as we know which tool to use).
For this purpose, we need vlc in order to convert the video. If you are on Ubuntu:
Note: if you go on the terminal before running this command, ubuntu will recommend to install vnc-nox. This installation will not contain the image encoders so it is better to install vlc package with its dependencies
Now that we have the command available. Let's convert the video using the following command:
A few comments on what this command does:
For this purpose, we need vlc in order to convert the video. If you are on Ubuntu:
sudo apt-get install vlc
Note: if you go on the terminal before running this command, ubuntu will recommend to install vnc-nox. This installation will not contain the image encoders so it is better to install vlc package with its dependencies
Now that we have the command available. Let's convert the video using the following command:
cvlc --video-filter scene -V dummy --scene-format="png" --scene-ratio=24 --scene-prefix=test --scene-path=<folder> <path-to-video> vlc://quit
A few comments on what this command does:
- We use cvlc and not vlc as this command we want to run as a command-line utility and avoid opening a new windows
- --video-filter scene: informs vlc that we want to use the scene module
- -V dummy: to avoid opening a window to show the video
- --scene-format=png: describes that we want to export the images in PNG format
- --scene-ratio=24: determines that 1 frame every 24 must be captured
- --scene-prefix=test: every new image will start with the string "test"
- --scene-path=<folder>: the images will be created in the folder test
- <path-to-video>: the path containing the video
- vlc://quit: to make sure that the we leave the command-line when all the images have been converted
Saturday, May 5, 2012
How to convert a video from one format to another?
To convert a video from a particular format (let's say mov) to another (let's say mpeg). I use avconv.
In order to have it in your Ubuntu distribution:
Now you can convert your video using the following command:
In order to have it in your Ubuntu distribution:
sudo apt-get install ffmpeg
Now you can convert your video using the following command:
avconv -i <source_file.mov> <target_file.mpeg>
How to map a mounted VMWare folder in Linux?
I have installed linux and configured the guest OS to see a particular folder from host.
As I already installed VMWare tools on the guest OS, I should see on /mnt/hgfs the different folders from host OS. I would prefer for simplicity's sake see this folder in my home directory. To perform it:
As I already installed VMWare tools on the guest OS, I should see on /mnt/hgfs the different folders from host OS. I would prefer for simplicity's sake see this folder in my home directory. To perform it:
ln -s <path-to-hgfs-folder> <name-of-mount-point>
Thursday, March 29, 2012
Comparison of free project management tools
I have played with a few free project management tools and here is a first summary. I am not an expert of PM...
- OpenProj
- Easy to use
- PERT and Gantt diagram
- PERT diagram is a bit difficult to read
- Collabtive
- Quite complex to install
- No PERT diagram
- No Gantt diagram unless you pay
- Good UI
- redmine
- Quite easy to install
- Gantt diagram
- No PERT diagram
- Planner
- Easy to use
- Provides only Gantt diagram
- No PERT diagram
- GanttProject
- Easy to use
- PERT and Gantt diagrams
- Does not provide subtasks
Install redmine on Ubuntu
Installing redmine on Ubuntu is quite straigthforward as you just need to follow this steps. Except that the passenger library must be installed as well. So it is better to start with this command:
Do not configure to follow the step for the database configuration.
sudo apt-get install redmine redmine-mysql libapache2-mod-passenger
Do not configure to follow the step for the database configuration.
How to install Collabtive on Ubuntu
To install collabtive on Ubuntu:
sudo apt-get install mysql-server phpmyadmin collabtive
- I do not care about the security and set the passwords empty.
- This will install collabtive that will be accessed through http://127.0.0.1/collabtive
- Try now to access it. If the screen is completely white, it probably means the apache thread is not allowed to read/write collabtive
- In order to verify it, read
/var/log/apache2/error.log
If you get such message:
[Thu Mar 29 02:18:51 2012] [error] [client 127.0.0.1] PHP Fatal error: Smarty error: unable to write to $compile_dir '/var/cache/collabtive/templates_c'. Be sure $compile_dir is writable by the web server user. in /usr/share/php/smarty/Smarty.class.php on line 1093
That means you have to provide access:sudo chown -R www-data /var/cache/collabtive/templates_c/
sudo chown -R www-data /usr/share/collabtive/www
sudo chown www-data /etc/collabtive/config.php
sudo chmod +w /etc/collabtive/config.php
- Create the database:
sudo mysql
and create the database you want:create database collabtive
- Now, you should be able to access and configure collabtive http://127.0.0.1/collabtive/install.php
Subscribe to:
Comments (Atom)