All right!
Author Archive
Extract the sources to some folder, open the command prompt and go to that directory.
Then enter following commands…
> bootstrap.sh > bjam.exe --toolset=msvc --link=static --runtime-link=static --build-type=complete stage
If you’ve upgraded Perl on your Gentoo box to 5.12, and tries to reemerge ImageMagick, you might get this error:
Could not find a typemap for C type 'Image::Magick' in Magick.xs, line 2404 make[3]: *** [Magick.c] Error 1 make[3]: Leaving directory `/var/tmp/portage/media-gfx/imagemagick-6.7.1.0/work/ImageMagick-6.7.1-0/PerlMagick' make[2]: *** [install-exec-perl] Error 2 make[2]: Leaving directory `/var/tmp/portage/media-gfx/imagemagick-6.7.1.0/work/ImageMagick-6.7.1-0' make[1]: *** [install-am] Error 2 make[1]: Leaving directory `/var/tmp/portage/media-gfx/imagemagick-6.7.1.0/work/ImageMagick-6.7.1-0' make: *** [install] Error 2 * ERROR: media-gfx/imagemagick-6.7.1.0 failed (install phase): * emake failed * * If you need support, post the output of 'emerge --info =media-gfx/imagemagick-6.7.1.0', * the complete build log and the output of 'emerge -pqv =media-gfx/imagemagick-6.7.1.0'. * The complete build log is located at '/var/tmp/portage/media-gfx/imagemagick-6.7.1.0/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/media-gfx/imagemagick-6.7.1.0/temp/environment'. * S: '/var/tmp/portage/media-gfx/imagemagick-6.7.1.0/work/ImageMagick-6.7.1-0' >>> Failed to emerge media-gfx/imagemagick-6.7.1.0, Log file: >>> '/var/tmp/portage/media-gfx/imagemagick-6.7.1.0/temp/build.log'
Reemerge with:
# USE="-perl" emerge -av imagemagick These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild N ] media-gfx/imagemagick-6.7.1.0 USE="bzip2 corefonts cxx jpeg openmp png tiff truetype xml zlib -X -autotrace -djvu -fftw -fontconfig -fpx -graphviz -gs -hdri -jbig -jpeg2k -lcms -lqr -lzma -opencl -openexr -perl -q32 -q64 -q8 -raw -static-libs -svg -webp -wmf" 0 kB Total: 1 package (1 new), Size of downloads: 0 kB Would you like to merge these packages? [Yes/No]
After some minutes:
>>> Recording media-gfx/imagemagick in "world" favorites file... >>> Auto-cleaning packages... >>> No outdated packages were found on your system. * GNU info directory index is up-to-date.
You might also want to update /etc/portage/package.use with “media-gfx/imagemagick -perl” if you don’t need Perl with ImageMagick.
Shamelessy copied from Fog Creek software.
A programmer is most productive with a quiet private office, a great computer, unlimited beverages, an ambient temperature between 68 and 72 degrees (F), no glare on the screen, a chair that’s so comfortable you don’t feel it, an administrator that brings them their mail and orders manuals and books, a system administrator who makes the Internet as available as oxygen, a tester to find the bugs they just can’t see, a graphic designer to make their screens beautiful, a team of marketing people to make the masses want their products, a team of sales people to make sure the masses can get these products, some patient tech support saints who help customers get the product working and help the programmers understand what problems are generating the tech support calls, and about a dozen other support and administrative functions…
It’s such nice words about us programmers
.
Add this line in .screenrc to display the clock in your screen. It also prevents ssh and tcp timeout.
caption always '%c:%s'
open failed: administratively prohibited
Is an error where you are doing circular port forwarding.
This command will generate this error:
# ssh -L 0:1234:localhost:1234 localhost
Connect to localhost:1234 and you get this error in your ssh terminal.
Boost::format’s performance sucks.
I used boost::format in an inner loop in my project, and the optimized runtime was 20 seconds for 1 small case.
I optimized away boost::format by replacing it with stream manipulators and i got the runtime down to 2 seconds for the same case.
I’ll publish an article later on the details on how to do this.
I always forget how to use boost::format when I need it. So, here are a few samples from when I did remember.
Only need is to include the proper boost header. No compile of any of the boost libraries is necessary.
The source is also available in subversion (webclient) (subversion checkout).
// build with make or:
//
// g++ -I../../boost_1_46_0 fmt.cpp
//
#include <iostream>
#include <sstream>
#include <boost/format.hpp>
using namespace std;
using namespace boost;
int main()
{
stringstream ss;
int year = 2011;
int month = 3;
int day = 11;
int hour = 12;
int minute = 1;
double seconds= 23.35;
double epoch = 1231234567890.35;
// Fill with whitespace, right align
ss << format("#1.0 %4i %4i %4i\n") % year % month % day;
// Output: #1.0 2011 3 11
// Fill with whitespace, left align
ss << format("#1.1 %-4i %-4i %-4i\n") % year % month % day;
// Output: #1.1 2011 3 11
// Fill with zero (pad)
ss << format("#2.0 %04i %04i %04i\n") % year % month % day;
// Output: #2.0 2011 0003 0011
// Floating point precision
ss << format("#3.0 %11.2f\n") % seconds;
// Output: #3.0 23.35
// Floating point precision with zero-fill (zero pad)
ss << format("#4.0 %011.2f\n") % seconds;
// Output: #4.0 00000023.35
// Left aligned string literal with 30+20 columns
ss << format("#5.0 %-30s%-20s\n") % "LEFT ALIGNED 1" % "LEFT ALIGNED 2";
// Output: #5.0 LEFT ALIGNED 1 LEFT ALIGNED 2
// Right aligned string literal
ss << format("#6.0 %30s%20s\n") % "RIGHT ALIGNED 1" % "RIGHT ALIGNED 2";
// Output: #6.0 RIGHT ALIGNED 1 RIGHT ALIGNED 2
cout << ss.str();
return 0;
}
The output should be:
#1.0 2011 3 11 #1.1 2011 3 11 #2.0 2011 0003 0011 #3.0 23.35 #4.0 00000023.35 #5.0 LEFT ALIGNED 1 LEFT ALIGNED 2 #6.0 RIGHT ALIGNED 1 RIGHT ALIGNED 2
Inept management hires inept arrogant conceited glory hogging twit
Inept management promotes twit at twit’s urging
Twit hires more twits for personal gain
Twit blames remaining competant workers for downward spiral
Remaining competant worker leaves
Company does well-deserved tail spin, crashes and burns
This code will open Explorer and select the file or folder given.
static void openInExplorer(string path)
{
string cmd = "explorer.exe";
string arg = "/select " + path;
Process.Start(cmd, arg);
}