Include Full BibTeX Entry Inside Text

This isn’t rocket science, but you can insert BibTeX entries as you go, instead of (dumping all the references at the end in a “References” section. It’s useful when writing many chaotic pages of notes as you crawl through dozens of publications on a particular topic you’re researching, or when making a slide presentation in Beamer.

\usepackage{bibentry}

\begin{document}

% don't show the full list of references
\nobibliography*

% include the bibtex file
\bibliography{database}

% reference individual bibtex entry 'bla'
\bibentry{bla}

% define the style of the bibentry citation
\bibliographystyle{style}

\end{document}

Another way is to use the biblatex package. Note, that at least in Ubuntu, you need to biblatex doesn’t come even with the full install of texlive-all and needs to be added seperately in the repository as a package of the same name.

% 'style' can be defined as options to this command
\usepackage{biblatex}

% \jobname is the name of this file
\addbibresource{\jobname.bib}

\begin{document}

% full bibliography section if you like
\printbibliography

% 'bla' is the bibtex entry label
\fullcite{bla}

\end{document}
Posted in Programming | Tagged , | Leave a comment

Backward Compatibility in C++ Libraries

Backward compatibility is an important design goal of a software system that says that a new version of the software should play nice with the old version. As an example, Microsoft Windows has done a remarkably good job (in my opinion) of achieving backward compatibility over the years, while seemingly not planning ahead to any reasonable degree. Yes, that’s a compliment disguised as a criticism, or visa versa.

It seems that developing standards for a technology help make backward compatibility much easier to achieve in the future. This is probably due to the fact that getting a bunch of intelligent egos to agree on a standard requires a lot of discussion of the future, in the process helping clear out the cloud of uncertainty that is the cutting edge of tomorrow.

That’s why it’s always surprising to me when a well-established C++ library officially breaks backward compatibility as in this latest example from Boost. It’s certainly easier to fix a design flaw by starting over. Whether this is the right approach for the long term success of a project is another question. In this case, I just smile, nod, and go back to update the old code to the new API.

Posted in Programming | Tagged , , , , | Leave a comment

WampServer vs XAMPP

wamp-server-easy-configuration-menuThis is not an Earth shattering post. Moreover, it’s not an objective one, that is, it is based on my experience and my experience only.

WAMP is a bundle of Apache, MySql, and PHP (though often also Perl and/or Python) for Windows. These are the things you need to run a dynamic website (in my case, for development and testing) on your computer in Windows. The idea is that a WAMP bundle makes the process of downloading, installing, and configuring the individual components easy and quick.

The two most popular WAMP tools are XAMPP and WampServer. I used XAMPP for a couple years, but it started disconnecting me from the internet recently for some unknown reason (that is probably my fault). I tried to fix it, and couldn’t especially given the conditions under which the problem arose were hard to pin down precisely.

So I installed WampServer instead last week, and I have to say that the basic task of turning everything on and off, tweaking configuring, enabling modules, changing versions of individual components, etc is a lot easier in WampServer. By “easier” I mean it’s more intuitive. The little menu that pops up from WampServer icon in the taskbar has all the options you need and none you don’t.

There may be people out there that have had a different experience, but I know I myself was wondering whether grass is greener on the other side, and in this case it was!

Posted in Tools, Web Development, Windows | Tagged , , , , , , , , | 3 Comments

Sorting a Sorted List in C++

It came to my attention that I didn’t know how well STL sorting algorithms performed on a vector of values that are already sorted. One would hope it would be close to \(O(n)\). This page does a comparison of various algorithms on vectors that are sorted to varying degrees. However, I’m interested in the case when the vector is fully sorted. A simple \(O(n)\) would remove the need to run the sorting algorithm on a list that’s already sorted. It makes perfect sense that the STL implementation of std::sort does not perform this check. I confirmed this fact by running the following simple test:

    for(int s=0; s<=10; s++) {
        const int n = 1000 * 1000 * 10 * s;
        vector<int> v(n);
        iota(v.begin(), v.end(), 0);
        std::sort(v.begin(), v.end());
        std::is_sorted(v.begin(), v.end());
    }

The results with no optimization turned on:

The results with -O2 optimization:

Conclusion: if you expect that the list might be sorted more often than not, run std::is_sorted on it first.

Posted in Programming | Tagged , , , , | Leave a comment

Auto Save Files in Emacs

I’m resolving to make more frequent and regular posts on this “research” blog that’s so far has been just a place where I write down some basic tips and tricks that have to do with tools I use in programming (which is just one part of my research life). I’m not sure it’s ever going to be more than that. I take an enormous amounts of notes offline, but never quite make the effort to convert those notes into a form that I’m comfortable making public.

Anyway, to the topic of the post… auto-save functionality in Emacs. By default, Emacs auto-saves a buffer with changes in it to the same directory as the file opened in the buffer, but adds a character such as # or ~ to the beginning or end.

This auto-savin’ can be turned off with:

(setq make-backup-files nil)

But today I turned it back on, and decided, since I use SVN anyway for versioning, that I will auto-save into the same file. This is achieved with the following:

(setq auto-save-visited-file-name t)

Also, I turned up the rate at which Emacs auto-saves the files.

(setq auto-save-interval 20) ; twenty keystrokes
(setq auto-save-timeout 10) ; ten idle seconds

Some useful links:

Posted in Tools | Tagged , , , | Leave a comment

Software for Recording FLV Video Stream

Live streaming FLV events are usually delivered via RTMP protocol. There are several tools that can capture these streams and others. Here is the list of the ones you should look into.

This is useful for recording live video streams of lectures or other events. I’m not sure what the legality of recording streams are. So I would consider it on a case by case basis, and contact the owners of the stream when in doubt.

Posted in Tools | Tagged , , , , , , | Leave a comment

Open Source Software Engineering is Not Communism

I’ve worked on a number of software engineering projects over the years that involve a group of 3-5 developers. I’ve also contributed to large open source projects of 20+ developers.

The figure to the left is taken from a post by the Qt guys on open governance roles.

In my experience, the roles of developers should be structured precisely as the figure suggests: hierarchically. Despite the view of open source projects as being built “by the people”, the flat model simply does not work in a world populated by human beings (with egos and opinions). It’s the difference between representative democracy and pure democracy. The overwhelming number of design decisions and designer opinions can bring a project to a halt.

Structuring the developers in a pyramid may very well produce a worse (less maintainable, less general, more coupled, etc) design, but it will produce one, in a reasonable amount of time. Sometimes cold code churn is more important than the philosophical soundness of the design. The pyramid encourages code churn, and discourages stale mates over controversial design decisions.

Posted in Programming | Tagged , , , | 2 Comments

LaTeX and Google Docs

google-docs-plus-latex

I came across a project called latexlab which seeks to develop a web-based LaTeX editor by utilizing the Google docs base editor and Google Web Toolkit.

I played around with it for about 30 minutes and am very impressed. You can compile the LaTeX source using the cloud or locally. Of course, I imagine there are huge challenges that the developers have to overcome. As it stands now, the many offline LaTeX development environment are far superior for those willing to withstand the semi-steep learning curve and a bit of hacking.

The bottom line is that LaTeX does not garner much interest from the part of the developer community that likes the simple web-based (e.g. Google docs) editors. I think this project (or ones like it) will help standardize the writing of academic articles with extensive math content on the web. MathJax is another project which is making the inclusion of LaTeX equations in webpages easy and beautiful.

Posted in Tools, Web Development | Tagged , , , , | Leave a comment

Ubuntu 11.04 Unity Gets in the Way of the User

ubuntu-unityUbuntu has released a new version (11.04) of its Linux operating system. Instead of going with Gnome 3, it went with Unity as the default desktop environment.

I’ve now used both Unity and Gnome 3, and it continues to confuse me who the target user is for these interfaces. If it’s meant to be easy, natural, and sexy like Mac OS X (which I don’t like by the way), I believe it fails to achieve that. It’s not at all easy nor natural, though it is sexier than previous versions (Gnome 2).

I have to echo the negative early reviews of many Linux users that Unity simply gets in the way. Some problems I have are:

  • It’s unclear how to access apps and utils that are not immediately available through the dock or app search.
  • Lack of configurability
  • Launcher hide behavior is counter-intuitive. I understand it, but it’s not natural and I can’t configure it, but even if I could, I want the default behavior to be natural. This is exactly what was upsetting to me about Ubuntu 10.10 when the window management buttons moved from top right to top left. I understood that, but it was unnatural.

The bottom line for me is that Ubuntu is trying to dumb down the Linux interface instead of making it more powerful. A perfect example of how to change drastically for the better is the improvement of Microsoft Office 2007 over 2003 with the addition of the ribbon. To me, the ribbon had an annoyingly large learning curve but in many ways it was worth it. The interface was simplified and made more powerful and it didn’t get in the way of the user.

Posted in Linux, Tools | Tagged , , , , | Leave a comment

Exploring Database Tables with jQuery

I woke up this morning tired of phpMyAdmin, and decided to take a stand.

phpMyAdmin is a web-based tool that most big hosting companies use for their shared hosting plans. It’s powerful in terms of the set of features it supports, but it’s NOT powerful in terms of ease-of-use and how much I can get done per minute using its interface. I think the reason all the big hosts use it is because of its long-time focus on security. After all, fewer customers will blame the host for a bad interface to the database as compared to the customers that will go nuts at the sight of any security issue (even though the customer himself is almost always at fault).

Anyway, there are several much better alternatives to phpMyAdmin (my favorite first):

  • SQL Buddy – Looks great, works great?
  • MonoQL – Looks even better, but it’s very new… where the documentation?
  • Adminer – Unlike the above two, this one is not AJAXified (aka Web 2.0). It’s just a leaner, cleaner, and more natural phpMyAdmin

Now on to the topic suggested by the title of this post… There are generally three things I do with a database:

  1. View table data.
  2. Edit table data.
  3. Edit table structure.

It hit me this morning, as I was sipping coffee in my despair over phpMyAdmin, that I do (1) a lot more than (2), and I do (2) a lot more than (3). Moreover, I really only want a better interface for (1) and maybe (2). So basically I just want a sexy Web 2.0 way of viewing table data. Luckily, jQuery inspired a ton of people to develop just such tools. Here are some awesome-looking examples (my favorite first):

Posted in Misc, Tools, Web Development | Tagged , , , | Leave a comment