Problems and Solutions
When I encounter a frustrating computer problem for which internet help is hard to
find, I will try to put the solution here.
Creating an Eclipse Update Site with Source Code
For the full details on this problem and its solution, please
see this
blog post.
Select/Show/Reveal Java code in the Eclipse Java Editor
This one was really frustrating! Here's what I wanted to do: I wrote
my own Eclipse plugin and it deals with IJavaElements and ASTNodes, that
is, classes from the JDT framework. I had my own tree view, and I wanted
to make it so that if a user double-clicked an item in the TreeViewer
then that Java element would show up in the Java editor. Turns out
all of this good stuff is in the org.eclipse.jdt.ui.JavaUI class. Here's
how I did it:
IJavaElement element_which_was_selected;
JavaUI.openInEditor(element_which_was_selected, true, true);
The first true means, activate the editor, and the second
true means "reveal" this element. In other words, take me
to the line where it is located an highlight it. Seems easy in
hindsight!
Cygwin/Ocaml/X11: ld: cannot find -lX11
I was attempting to use the Graphics
module in Ocaml to create some simple graphs. I am using Cygwin, and I have X11 installed, but apparently not the
X11 development package, as I found out later. I followed their instructions to build a new top-level with
the graphics dynamically linked library built in. To do this, you type,
ocamlmktop -o mytop graphics.cma
Unfortunately, this gave me the following error:
ld: cannot find -lX11
The entire message was a bit longer because it gave me the full path of my
linker. At this point, I didn't know where the error was; was this a general
unix problem? A cygwin problem? Or a problem with my Ocaml setup. As it
turned out, while I had X11, I did not have the X11 development package in
cygwin! The absence of this package was verified by examining the
/usr/X11R6/lib directory, and seeing the absence of any file like, libX11.so.
To fix the problem, all I had to do was go to the cygwin setup application,
look through the list of packages to find one named libX11-devel, which was
inside the X11 category, and installing it. After this, everything worked
perfectly.
LaTeX: Some Font Shapre Were Unavailable
During a paper I wrote, there was a section where I had curly braces
('{' and '}') inside of a the \texttt tag. Unfortunately, and
for these characters only, the curly braces were not printing in a monospace
font. Moreover, when running LaTeX, I got two errors:
LaTeX Font Warning: Font shape `OMS/cmtt/m/n' undefined
(Font) using `OMS/cmsy/m/n' instead
(Font) for symbol `textbraceleft' on input line 743.
and
LaTeX Font Warning: Some font shapes were not available, defaults substituted.
Didn't know what to do! Unfortunately, the "some fonts shapes not available"
message can occur for many reasons. In my case, adding the additional
directive,
\usepackage[T1]{fontenc}
Fixed all my problems. Hooray!
Eclipse and 64bit Linux
I have run into this problem twice now and figured I'd better
write it down before I forget again. The combination of 64 bit Linux,
64 bit Java and 64 bit Eclipse can get pretty hairy. Often times I have
had them not work together, and Eclipse with crash on start-up. This
is usually accompagnied by strange error messages in my log file, for
example,
!ENTRY org.eclipse.osgi 4 0 2007-09-26 14:29:45.075
!MESSAGE Shutdown error
!STACK 1
java.lang.InternalError
at java.util.zip.Inflater.end(Native Method)
at java.util.zip.Inflater.end(Inflater.java:310)
at java.util.zip.ZipFile.close(ZipFile.java:488)
etc., with tons of ugly other stuff. Here's what has worked for me: If you have
64 bit Linux, use 64 bit Eclipse and the 64 bit Java JRE. (Note,
the first link for downloading Eclipse is not for the 64 bit version.) Then,
play around by trying out different versions of the 64 bit Java JRE & Eclipse
until the whole thing works. This sounds strange, but almost always
having the newest one of each will fix your problem.
MikTeX Include Directory
(Thanks to Donna for
this one!) Here's how you get MikTeX to look in a
particular directory for the files:
Instead of using TEXINPUTS, MikTeX uses the command line option
"-include-directory=foo" to prepend foo to the search path.
LaTeX: Using the \Box and \Diamond Symbols
I needed the Box and Diamond symbols for use in typsetting some work
related to
modal logic. Most of
the online symbol lists that you find say to use:
\Box and \Diamond
But I was getting the following error:
LaTeX Error: Command \Diamond not provided in base LaTeX2e.
What they don't tell you, but what I finally found in the
"List of every LaTeX symbol ever, even ones you would never, ever use"
is that for some of the basic symbols (i.e. ones not in AMS or stmaryrd) you
stil have to include an extra package. Put this at the top of your
document, and everything will work:
\usepackage{latexsym}
JUnit Within Ant Within Eclipse
I've been trying to run an Ant build from within Eclipse that also runs
some JUnit tests automatically. This is a common problem, but some of
the solutions that I found weren't working. Anyway,
this blogger had a solution that worked.
Emacs: Get Rid of DOS Newlines
Since UNIX and Windows both have different ways of representing a newline,
I find that sometimes my scripts edited on a Windows machine will not run
on a UNIX machine because there is an additional character on each line.
Long story short, if UNIX complains about
'^M' you are in all likelyhood
having the exact same problem. Here is how I get rid of it using emacs. I
admit, this is not the fastest way to do it:
C-x RET c unix RET C-x C-f foobar.txt
This changes emacs' mode so that when it opens up files, it will open them in
UNIX mode. Then, the sequence of commands after the second return just opens
up your file. You can then see the
'^M' characters. I usually just
delete them by hand, but you can also do a regexp replace. (To search for
this character, (after you are in search mode) you have to type
^Q ^M The first command puts you
in quote mode, meaning that the next thing you type will be exactly what it
searches for.
Unix: Add DIR to PATH
I can never remember how to do this. You have two choices depending on your
shell. (Well okay, there are more choices, but who uses those other shells?)
Bash:
PATH="$PATH:/new_path_dir"; export PATH
Tcsh:
set path = ( $path /new_path_dir )
Windows && Emacs && ISpell: I had emacs for windows, and I wanted a spellchecker. It took me a short while to find which files to install but I settled on Ispell, and this prepackaged Windows version: http://www.luziusschneider.com/Speller/ISpEnFrGe.exe. After all that, I had to add ispell to my PATH in windows. Now I encountered my first tricky problem. When I ran Ispell from emacs, it would tell me that the dictionary at 'C:/usr/local/english.hash' could not be found. No kidding, that's not where my dictionary is. However, just selecting the 'Change Deafult Dictionary' option would not fix my problem. For some reason, even when I typed in the full path of my english.hash file, it would not accept my input. Finally I found a solution: In my '.emacs' file (Which goes in whatever directory the HOME variable points to.) I had to put the following line:
(setq ispell-extra-args '("-dC:/ispell/english/english.hash"))
This tells emacs that when it runs the ispell.exe executable, it has to run it with the given command line options. That particular option directs it towards the default dictionary file to use. Kind of bogus, but I just wanted to be able to spellcheck right away!
ML Comments A comment in ML has the following form:
(* Here is a comment
and here is the end *)
This information was surprisingly difficult to find on the web.
|