Sometimes you download a source code and it keeps asking you another (generally higher) version of gtk+ or libglade. For this problem, instead of changing your gtk+ and glade versions, you might just change the requirements of the source code you downloaded. This is not a guaranteed solution, but most of the time, it works. For example, I have gtk+ 2.8 at home and 2.4 at work. So, at work I can not compile my gtk+ codes. To tackle the problem, I found where the configure script checks for the gtk+ requirements and just changed the version number.
It looks like this(configure.ac file):
PKG_CHECK_MODULES(GRID_EDITOR, [gtk+-2.0 >= 2.8 libglade-2.0 >= 2.6 ])
Depending on your code and configuration, there might be more options, but changing the above to this does the trick for me.
PKG_CHECK_MODULES(GRID_EDITOR, [gtk+-2.0 >= 2.4 libglade-2.0 >= 2.4 ])
Monday, February 02, 2009
How to find the installed gtk+ and glade versions
If you need to find the currently installed versions of gtk+ and libglade,you can use the following commands to find them:
$>pkg-config --modversion gtk+-2.0
$>pkg-config --modversion libglade-2.0
Happy programming.
Monday, June 30, 2008
Full Screen Figures in Matlab
Matlab's native figure command does not give you an option to make your figure full screen in 1 step. Instead first you have to find the screen resolution and then give your figure command the size of the screen.
First thing you want to do is:
screen_size = get(0, 'ScreenSize');
This will return a 4 element array: (left, bottom, width, height);
The ones we are interested are the "width" and "height".
Now we have the size of the screen, we can make our figure full screen:
f1 = figure(1);
set(f1, 'Position', [0 0 screen_size(3) screen_size(4) ] );
Now you should have a figure that is full screen.
First thing you want to do is:
screen_size = get(0, 'ScreenSize');
This will return a 4 element array: (left, bottom, width, height);
The ones we are interested are the "width" and "height".
Now we have the size of the screen, we can make our figure full screen:
f1 = figure(1);
set(f1, 'Position', [0 0 screen_size(3) screen_size(4) ] );
Now you should have a figure that is full screen.
Saturday, June 14, 2008
Changing the SMTP port number in Evolution
I started using evolution email client in Ubuntu. However, my service provider requires me to use a different port for SMTP. When you first check the tab where you set the options for SMTP, you can not find a field about the port number of SMTP. I was looking for a field because Thunderbird has a field for port.
The solution is this :
smtp.hostname.com --> Assumes you are using port 25.
smtp.hostname.com:587 --> You set the SMTP port to 587.
I think this is not a good way to handle ports, but I am happy since I found a soluton.
The solution is this :
smtp.hostname.com --> Assumes you are using port 25.
smtp.hostname.com:587 --> You set the SMTP port to 587.
I think this is not a good way to handle ports, but I am happy since I found a soluton.
Wednesday, June 04, 2008
A simple problem with LLNL's VisIt
Recently I found the LLNL's visualization software called VisIt. It has many capabilities and the graphics looked promising from their screenshots. So I wanted to give it a try. However, I had a problem and found the solution with a trial and error way. Since VisIt is developed to be working on distributed systems and parallel systems, it is always using sockets to connect to its server part even you are using them on the same computer.
So when you call the main program with gui,
>visit.exe
It will generate the following commands
Running: "C:\Program Files\LLNL\VisIt 1.9.0\gui"
Running: "C:\Program Files\LLNL\VisIt 1.9.0\viewer" -geometry 1272x1020+408+0 -borders 22,4,4,4 -shift 4,22 -p
reshift 4,22 -defer -host your.hostname -port 5600
Running: "C:\Program Files\LLNL\VisIt 1.9.0\mdserver" -host your.hostname -port 5602
So if you are running it the first time, Windows will ask you to open the ports given above to be unblocked. I unblocked them.
Then suddenly at 32%, mdserver crashed.
After several forum messages and trials, I was still getting the same error.
Later, I installed VisIt to my home computer also and it worked without a problem. Therefore, I started looking for the differences between my two computers. The first and the most obvious difference was with the network connections. At my home computer I had VMWare installed. When you install VMWare, it creates several different network connections, which were enabled by default. Even though they are not real connections, VisIt still handled them according to their IP adresses.
Finally, I disabled all my network connections created by VMWare. Give one more try to VisIt and it started working.
I think the fix will be considered with the next release of VisIt.
So when you call the main program with gui,
>visit.exe
It will generate the following commands
Running: "C:\Program Files\LLNL\VisIt 1.9.0\gui"
Running: "C:\Program Files\LLNL\VisIt 1.9.0\viewer" -geometry 1272x1020+408+0 -borders 22,4,4,4 -shift 4,22 -p
reshift 4,22 -defer -host your.hostname -port 5600
Running: "C:\Program Files\LLNL\VisIt 1.9.0\mdserver" -host your.hostname -port 5602
So if you are running it the first time, Windows will ask you to open the ports given above to be unblocked. I unblocked them.
Then suddenly at 32%, mdserver crashed.
After several forum messages and trials, I was still getting the same error.
Later, I installed VisIt to my home computer also and it worked without a problem. Therefore, I started looking for the differences between my two computers. The first and the most obvious difference was with the network connections. At my home computer I had VMWare installed. When you install VMWare, it creates several different network connections, which were enabled by default. Even though they are not real connections, VisIt still handled them according to their IP adresses.
Finally, I disabled all my network connections created by VMWare. Give one more try to VisIt and it started working.
I think the fix will be considered with the next release of VisIt.
Export figures in Matlab without displaying them
Assuming you have a lot of figures to plot, but you do not want to wait and see them in Matlab's figure window. There is a way you can export all of your figures without displaying them. This might also save you some time, since you are drawing them on the screen.
Here is how :
% Create a figure with visibility off
f = figure('Visible','off');
% Then do your plot
plot
% Finally export the plot as an image
print('-dpng', 'test.png');
You can also make this in a loop (Which is very probable if you have too many figures).
Do this
for i:1, n
f = figure('Visible','off');
plot
filename = sprintf('plot-%d',i);
print('-dpng', filename);
end
This will give you 'n' png images with your plots in it.
Here is how :
% Create a figure with visibility off
f = figure('Visible','off');
% Then do your plot
plot
% Finally export the plot as an image
print('-dpng', 'test.png');
You can also make this in a loop (Which is very probable if you have too many figures).
Do this
for i:1, n
f = figure('Visible','off');
plot
filename = sprintf('plot-%d',i);
print('-dpng', filename);
end
This will give you 'n' png images with your plots in it.
Tuesday, February 19, 2008
Timing background jobs to a file
If you are running a lengthy simulation or a compilation, sometimes you might have to close/logout of your terminal. However, if you just use the "time" command with out redirecting it is output to a file, you will not see the output of time command. For example you run a job and left terminal like following:
$>time ./my_job > my_job_output &
This will run "my_job" in the background and send its output to "my_job_output". If you do leave your terminal open, you will see your run time information on the terminal screen. However, if you close your terminal window, you will not see this information since your strerr is now not available.
For this purpose, you can send your program output and time output to different files. Then, even if you close your terminal, you will still see your time command output:
$> (time ./my_job >my_job_output) >& time.out &
This way you will run your job in the background, see your time command output and you can close your terminal.
$>time ./my_job > my_job_output &
This will run "my_job" in the background and send its output to "my_job_output". If you do leave your terminal open, you will see your run time information on the terminal screen. However, if you close your terminal window, you will not see this information since your strerr is now not available.
For this purpose, you can send your program output and time output to different files. Then, even if you close your terminal, you will still see your time command output:
$> (time ./my_job >my_job_output) >& time.out &
This way you will run your job in the background, see your time command output and you can close your terminal.
Subscribe to:
Posts (Atom)