Stuckness shouldn't be avoided. It's the psychic predecessor of all real understanding. An egoless acceptance of stuckness is a key to an understanding of Quality, in mechanical work as in other endeavors. It's this understanding of Quality as revealed by stuckness which so often makes self-taught mechanics so superior to institute-trained men who have learned how to handle everything except a new situation. - Robert Pirsig, Zen and the Art of Motorcycle Maintenance
Wednesday, July 28, 2010
Monday, July 26, 2010
poisson_distribution broken in boost and g++?
I needed to generate samples from poisson distribution in c++. poisson_distribution happens to be a function included in C++0x. When I wrote the code and ran it using g++ 4.4.3 with std=c++0x, the code hung inside the poisson_distribution generator (i,e. operator()). I then converted my code to using boost 1.40 instead of g++. It still hung!
Then I decided to try out the code from MSDN documentation at http://msdn.microsoft.com/en-us/library/bb982217.aspx. This example hangs with both boost and g++!
I set a breakpoint inside the generator code. A product was being accumulated (starting from 1.0) and to be able to break it was checked to be less than a quantity less than 1. However the product was increasing, not decreasing, soon reaching to inf.
Then I decided to try out the code from MSDN documentation at http://msdn.microsoft.com/en-us/library/bb982217.aspx. This example hangs with both boost and g++!
I set a breakpoint inside the generator code. A product was being accumulated (starting from 1.0) and to be able to break it was checked to be less than a quantity less than 1. However the product was increasing, not decreasing, soon reaching to inf.
Friday, July 23, 2010
Extracting Libraries from Boost
I needed to use the Boost Spirit Library. I do not want to have to add all boost libraries into my project. To separate out only the dependencies of Spirit, I used the bcp tool:
This worked fine and sent to output to boost-spirit directory.
bcp --boost=./boost_1_43_0/ spirit ./boost-spirit
This worked fine and sent to output to boost-spirit directory.
Friday, July 9, 2010
Latex Notes
Bounding Box / Image
The primary and nasty problem I face with inserting jpg or png images into latex is related to "boundary box" (I do not recall the specific error messages as the last time I inserted a jpg image was long back). I have tried many things before but they have not worked for me. Here I am writing about another way to insert images without headaches, which might work (still untested):
@misc{stroustrup10,
author = "Bjarne Stroustrup",
title = {C++ Applications},
howpublished = "Website",
year = {2010},
note = {\url{http://www2.research.att.com/~bs/applications.html}. Accessed July 2010.}
}
Font/Itemize Labels
Tips: http://www.schneeflocke.net/index.php?section=latex/index#latexsrclst
Header/Footer
Tips: http://www.schneeflocke.net/index.php?section=latex/index#latexsrclst
Presentation Effects
Tips: http://www.schneeflocke.net/index.php?section=latex/index#latexsrclst
Latex Symbols
http://www.artofproblemsolving.com/Wiki/index.php/LaTeX:Symbols
http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf
Building Latex
Rubber: A single-point output builder from latex document: http://www.pps.jussieu.fr/~beffara/soft/rubber/
Comparison with other latex build systems: http://stackoverflow.com/questions/1240037/recommended-build-system-for-latex/
References
Not too short Introduction: http://mirror.math.ku.edu/tex-archive/info/lshort/english/lshort.pdf
Latex in Inkscape: http://jblevins.org/log/latex-in-inkscape
The primary and nasty problem I face with inserting jpg or png images into latex is related to "boundary box" (I do not recall the specific error messages as the last time I inserted a jpg image was long back). I have tried many things before but they have not worked for me. Here I am writing about another way to insert images without headaches, which might work (still untested):
- Find the image size. On unix, use the imagemagick "identify" command.
identify a.jpg
a.jpg JPEG 133x100 133x100+0+0 8-bit DirectClass 35KiB 0.000u 0:00.000
- Use the size to specify the bounding box:
\includegraphics[bb=0 0 133 100,scale=0.5]{a.jpg}Bibliography Style for Website
@misc{stroustrup10,
author = "Bjarne Stroustrup",
title = {C++ Applications},
howpublished = "Website",
year = {2010},
note = {\url{http://www2.research.att.com/~bs/applications.html}. Accessed July 2010.}
}
Font/Itemize Labels
Tips: http://www.schneeflocke.net/index.php?section=latex/index#latexsrclst
Header/Footer
Tips: http://www.schneeflocke.net/index.php?section=latex/index#latexsrclst
Presentation Effects
Tips: http://www.schneeflocke.net/index.php?section=latex/index#latexsrclst
Latex Symbols
http://www.artofproblemsolving.com/Wiki/index.php/LaTeX:Symbols
http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf
Building Latex
Rubber: A single-point output builder from latex document: http://www.pps.jussieu.fr/~beffara/soft/rubber/
Comparison with other latex build systems: http://stackoverflow.com/questions/1240037/recommended-build-system-for-latex/
References
Not too short Introduction: http://mirror.math.ku.edu/tex-archive/info/lshort/english/lshort.pdf
Latex in Inkscape: http://jblevins.org/log/latex-in-inkscape
Thursday, July 8, 2010
Recovering Windows Data After Crash
This must be familiar. My lab's Windows Vista crashed suddenly without reason and would not boot up again. Fortunately I had backed up my data (using Windows Backup) on a separate disk drive. I used an Ubuntu Live CD to boot and then I was able to recover data from zipped files from where windows had backed it into zipped files. Perhaps not surprisingly or surprisingly, I was unable to mount and access the disk drive that previously ran Windows.
Subscribe to:
Posts (Atom)