Archive

Archive for the ‘Software’ Category

A LaTeX wrapper for homework

April 1st, 2009
Comments Off

Apropos of nothing… here are two examples of empty LaTeX files suitable for everyday use (e.g. homework). These templates don’t necessarily conform to any particular standard, but I think they are reasonable.

\documentclass{article}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{float}
\usepackage{enumerate}
\usepackage{fancyhdr}
\usepackage[left=0.75in, top=1in, right=0.75in, bottom=1in]{geometry}
\pagestyle{plain}
\begin{document}
    \rhead{Student Name\\School 101: Homework 1}
    \thispagestyle{fancy}
 
    % The list environment is just to get some vertical spacing
    \list{} \item \endlist
 
    % Let the homework begin!
    \section*{Question 1}
    \subsection*{Part (a)}
    Yes
    \subsection*{Part (b)}
    No
 
    \section*{Question 2}
    Maybe
\end{document}

Looks like this,

A variation with a simpler header,

\documentclass{article}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{float}
\usepackage[left=1in, top=1in, right=1in, bottom=1in]{geometry}
\pagestyle{plain}
\newtheorem{theorem}{Theorem}%[section]
 
\begin{document}
    \begin{flushright}
    Student Name\\School 101
    \end{flushright}
 
    \section*{Exercise 42}
    Eureka!
 
    \begin{theorem}
        \textit{(A useful equivalence)}\\
        $P = NP$
    \end{theorem}
    \begin{proof}
        By inspection.
    \end{proof}
\end{document}

looks like this,

Enjoy!

Anthony Software

Octave + Image package + Mac OS X

November 14th, 2008
Comments Off

A quick public service note for anyone else trying to install the Image package (1.0.8 was the version I downloaded) with Octave (3.0.3 was the version I had) installed as Octave.app from the Octave Forge page.

I had ImageMagick 6.4.1 installed via fink on OS 10.4.11, but installing the Octave Image package was failing on

mkoctfile __magick_read__.cc

Looking in image-1.0.8/src/Makefile, there is the line

$(MKOCTFILE) $< `Magick++-config --cppflags` `Magick++-config --ldflags`

which, it turns out, needed to be

$(MKOCTFILE) $< `Magick++-config --cppflags` `Magick++-config --ldflags` `Magick++-config --libs`

for me.

Since it took me several hours to sort this all out, I’m putting it here for anyone else having trouble getting the Image package installation to link with ImageMagick.

Anthony Octave, Programming, Software

Gearing Up for Synchronization

June 6th, 2007
Comments Off

I think Dare’s hit on a big question mark surrounding technologies like Google Gears: branch and merge. I’m sure that any programmer who’s used source control and thought about how it all works has come up with situations in which an automated merge just isn’t possible (e.g. two people edit the same line of source). In the server replication arena, the same thing happens if you have backup servers that fail a lot. With one failure, you can switch to a backup, and then playback the changes to the first system when it comes online again (or even do a full re-sync). But if the backup goes down, then the primary comes online, you’ve got issues. The first server will potentially present the user with a state that is inconsistent with changes the user has made. This is the same scenario that will be encountered by users interacting with web services in offline mode. Make no mistake: this is not a solved problem. There are always going to be scenarios that will reveal the fact that offline != online.

That said, I don’t think too many software developers using a one-user source code repository have any problem mentally recognizing the need for offline changes to be synced before they will be available from the server. It’s a valid question whether or not that understanding will be found in people using Google Docs in offline mode, and I think it’s also the case that, a deeper understanding of the situation notwithstanding, developers have an easier time of merging thanks to a usage pattern based on having many discrete files that can be edited independently (that is, merging the text is less of a problem even if dependencies can break the program). But my opinion is that it won’t be that big of a deal. Most users won’t be editing documents on multiple devices with any great frequency, so there’s less of a chance of stumbling into an inconsistent state. Moreover, despite specifically targeting the disconnected state of modern devices, I don’t think the people providing offline enabling technologies are arguing that that state will be anything other than a transient disturbance (e.g. going through a tunnel, cable’s out for an hour, etc.). In that case, the most critical question when evaluating the potential for trouble relates to a specific usage pattern: how likely is it that the first device a user connects to an online service after a period of involuntary disconnectedness is the same as the last device the user connected with? I’d say it’s pretty likely, and, in that case, manual merges won’t become a significant part of software usage for the masses.

Anthony Google, Software, Technology

Probably Too Cynical

May 17th, 2007
Comments Off

There’s a lot of back and forth about the RIA frameworks with big backers: Apollo, Silverlight, and JavaFX. I like to think of myself as a great audience for these things because I eat up technology hype. So, true to form, I wanted to try out all of these new toys to see what they offered. In particular, I’m always frustrated by crummy support for drawing APIs for scripting languages and in-code GUI specification, so all three contenders seem aimed straight at my heart. Here’s what happened as, on the launch day of each or shortly thereafter, I gave each a whirl:

  • The process of building something for Apollo seemed to involve stitching together a lot of parts. I got some glue, started working, and realized I was building a web page with flash. The main new offering here is the runtime, but, without a specific use of the runtime, I realized that it wasn’t actually offering me anything.
  • Silverlight got me really excited with the DLR and its promise of dynamic language interoperation and cross-platform support (at least Mac and Windows). So I installed the 1.1 toolset, found that the examples didn’t work, and then read the requirements indicating that it wouldn’t work on a PPC Mac (like the one I was sitting at). I later tried it on an Intel MBP, and it didn’t work there, either. I’m sure it could be made to work on the Intel Mac, but my excitement had departed by that point.
  • JavaFX. I don’t use Java, but I’m fine with it as a language. However, I still remember the pain of running Java applets in the early days. Then the cross-platform Java GUIs that were just hideous and slow. All that still rattles around my head, but I was excited by some of JavaFX’s features (things like binding closures, and the GUI declaration syntax). I downloaded the bits, and double clicked on javafxpad.jnlp because it sounded promising. Then I waited for a while. It opened, and I was greeting with a minimally-decorated split-pane window showing a canvas and its code. Cool. I clicked in the source pane to make sure it had focus, then tried to scroll the window using the scroll-area of my pointing device. Nothing happened.

So, at the end of my testing, I was left feeling like there was nothing new, there wasn’t really cross-platform support, and cross-platform GUIs still stink when they hit you with those jarring inconsistencies from your native desktop. Apollo is in a tough spot as it tries to argue that it’s adherence to the web as we know it is a good thing and bypasses the question of, “What’s new here?” while others argue that it’s holding on to the bad parts of the web (namely, distributing opaque blobs and closed source flash). Microsoft has defined a fantastic path for Mono to follow and create something neat. JavaFX has some great features that could really improve the state of mobile development. But today? I’ve moved all those SDKs and toolsets to a directory out of sight. I’ll be waiting for a reason to revisit them.

Anthony Software

Multiple Dispatch in C#

April 12th, 2007
Comments Off

I recently encountered a situation in which I wanted double dispatch method invocation in a C# program, so I wrote a simplistic implementation of that very mechanism. I’ve written up an article describing this technique that I’m not including in the blog since it is long for a blog post and fairly technical. There is a sample program included with the article, and I encourage anyone with an interest in C#, or anyone wondering about how to get multiple dispatch in mainstream object-oriented languages, to take a look.

Update Jay Bazuzi follows up on this topic.

Anthony .NET, Programming, Software