Thursday, June 24, 2010
Monday, June 21, 2010
Of course those problems have been entirely solved quite soon. I suppose that by the end of the year they were no more and the faster intel chips were just the right choice for everyone. A couple of years after those events I bought a MacBook Pro 15” laptop and that became my main work machine. Among the things I really liked best about the intel processor (and all the lovely virtualization software packets out there) was that I could run Linux in a virtual machine. Since I did not stop working on a certain “almost-linux-only” project, that was really good (and saved me from ugly partitioning). Although I had a Parallels license (which I used on the iMac), I preferred to use the simpler VirtualBox. Back in the day, Parallels did not support Linux exceptionally well and I could just live with the free VB. And that is the machine I used (along with the iMac) for my M.Sc. dissertation.
4 years after i first turned it on, my iMac blew off. Well, not literally. I suppose I can fix it, however, I chose to buy a new Mac. This time it is a MacPro. Essentially, I hated that if I thrashed my iMac (because of other damages) I could not save the monitor. So I chose a monitor-less computer. Essentially the thing is powerful. It is extremely evident when encoding my CDs into mp3’s. I don’t do much video editing.
Nonetheless, Parallels is completely capable of sucking all the resources. I had to stop using it, since the MP became useless. I suppose it may be related to having only 3 GB, even though the iMac had only 2. If I will need a virtualization software, I suppose I’ll go with VMWare or VirtualBox. But… that is not the last machine I bought.
Probably I would have regretted if I chose another blog service.
This also makes me think writing the crappy little blogging application for Linux should be pretty easy. :)
Sunday, June 13, 2010
read_all([Predicate|T]) :- read(Predicate), Predicate \== end_of_file, !, read_all(T). read_all(). read_file(File, L) :- see(File), read_all(L), seen.If we call read_file to read "read_file.pl" (spaces added by me):
?- read_file('read_all.pl', L). L = [(read_all([_A|_B]):-read(_A),_A\==end_of_file,!,read_all(_B)), read_all(), (read_file(_C,_D):-see(_C),read_all(_D),seen)] ? yThe display predicate some prolog interpreters provide gives us more insight on internal representation of terms. We call it on just one rule in order not to clutter the output with list representations:
?- read_file('read_all.pl', [H|_]), display(H). :-(read_all(.(_932,_952)),,(read(_932),,(\==(_932,end_of_file),,(!,read_all(_952)))))And here on the full program (notice... lists are "consed" with the '.' functor):
?- read_file('read_all.pl', L), display(L). .(:-(read_all(.(_900,_920)),,(read(_900),,(\==(_900,end_of_file),,(!,read_all(_920))))),.(read_all(),.(:-(read_file(_1410,_1430),,(see(_1410),,(read_all(_1430),seen))),)))Indeed, infix operators have been placed in prefix form like every other predicate (indeed, they are not special, just a parsing trick). Another "useful" predicate (not standard) is portray_clause/1, in order to do some "pretty-printing":
?- read_file('read_all.pl', [H|_]), portray_clause(H). read_all([A|B]) :- read(A), A\==end_of_file, !, read_all(B).
The assert family of predicates can “store” into the Prolog database facts (this is very common, in fact, memoization is often implemented this way) and rules (this is done less frequently – and there may be a slight efficiency penality [CHECK]). Thus we can manipulate terms (indeed that is what Prolog is about) and load them as programs. Notice that I showed the read predicate only to show that “standard” Prolog programs are represented that way, but it is not necessary at all to use programs saved in files.
4 ?- assert((foo(X) :- bar(X), \+ baz(X))). true. 5 ?- assert(bar(1)), assert(bar(2)), assert(baz(2)). true. 6 ?- foo(X). X = 1 .
Monday, June 7, 2010
In fact, I did not think the thing would have gotten tricky (ah, how naive!). Word 2007 has a nice "save to PDF" menu item and I thought I could use that to solve my problem. Luckily enough, I double checked the generated PDF on the Mac. And, apparently, all the bold fonts were substituted with another font. I already mentioned this in a post earlier today.
This is completely illogical since the font was Times New Roman and I have Word on the Mac as well, which would install a lot of additional fonts, even if TNR was not that standard. So I searched for a Windows PDF creator (which, by the way both OS X and Linux-based desktop programs have). I found a bunch of them, some commercial, some free, some open source. My choice was PDFCreator.
Some reasons are: i) it is free as in free beer, ii) it is free as in free speech, iii) had no ads, iv) is based on the same softwares I happily used with Linux. Of course, reason i) was paramount: I had no intention to buy a stinking PDF creator for Windows unless it is absolutely necessary (which may be). The other three reasons have to be considered together: I searched google for suggestions, but I had no clue on which one was supposed to be better.
Usually the only problem with open source software is lack of support/user friendliness. However, that was not the case of PDFCreator. Unfortunately, for reasons beyond my comprehension, the generated pdf completely screws a TIFF picture I put in the document. The same picture is perfectly fine in the PDF generated with word built-in generator. I tried to include in word a PDF, but that did not work either (the PDF was linked, but not visible -- nor printable --). Amazingly, Word for Mac is capable of using PDF image files, IIRC.
Perhaps, I should have tried more generators. I went home, opened Word for Mac, double checked that the formatting was fine (which was not, but I could fix it in little time) and simply printed to PDF. The PDF is perfect. This goes under: how to completely waste a Monday morning.
Footnotes This is a technical term, essentially it looked like it had low resolution
- McIlroy, M. D. 1960. Macro instruction extensions of compiler languages. Commun. ACM 3, 4 (Apr. 1960), 214-220. DOI
- MOOERS, C.N. TRAC, a text handling language. Proc. ACM 20th Nat. Conf. Cleveland, Aug. 1965, pp. 229-246.
- Not meant to be offensive… perhaps old could be replaced with ancient?
Why is the bibliographic tools such a joke that almost everybody does it by hand (and, moreover, many conferences explicitly tell you to do it by hand? and the W2007 implementation is not compatible with W2003 – at least that is the opinion of W2007 on that matter)
And using images is a PITA. But that is a PITA with Latex as well. Last but not least, I have yet to understand why a PDF created with word for windows visualize bold characters (I'm following the IEEE template, so changing the font is not an option... besides, it's times new roman) with a *different* non-bold font when opened on the Mac. If it were not such a standard font I would have said it's a matter of not including the font.
Thursday, June 3, 2010
Goals: be easy to use, be easy to install
Right now, it does less than needed. However, I plan to add features as I need them. Besides, I want to make it as DRY as C++ allows, even at the cost of fighting with template metaprogramming.
However, I hope I won't need boost, as it would be a rather important and expensive dependency.