Kjosmoen.org - Hometag:kjosmoen.org,2008:mephisto/Mephisto Noh-Varr2008-10-10T10:47:15Zthomastag:kjosmoen.org,2008-10-10:3022008-10-10T10:42:00Z2008-10-10T10:47:15ZMATLAB/Octave bundle update - goodies abound
<p>This update brings a few fixes, as well as a couple of new functions.</p>
<ol>
<li>The bundle will now allow you to open function files by hitting ⇧⌘O. This was poorly implemented before, but the new version actually grabs your MATLAB/Octave path definitions and opens the m-file in question. If the function is a compiled p-, mex-, or oct-file, or if the function is not in your current MATLAB/Octave path, you will receive appropriate error messages.</li>
<li>TextMate now gives you completion on functions in your MATLAB/Octave path! The feature, which is accessed using ⌥⎋, will do a search through all functions in the path and present them in a menu. See the images below for demonstration.
<img title="Function completion in MATLAB" src="http://kjosmoen.org/assets/2008/10/10/Picture_2.png" alt="Function completion in MATLAB" />
<img title="Function completion in Octave" src="http://kjosmoen.org/assets/2008/10/10/Picture_3.png" alt="Function completion in Octave" /></li>
<li>You can now open your command history in both MATLAB and Octave.</li>
</ol>
<p>Again, if you have any bugs or problems to report, please drop me an email.</p>
<p>The latest Matlab/Octave bundle can be downloaded via <a href="https://svn.ux.uis.no/svn/textmate/Matlab.tmbundle">svn</a>. If you don't want to mess with svn, you can download the zip file <a href="https://projects.ux.uis.no/projects/list_files/textmate">here</a>.</p>
thomastag:kjosmoen.org,2008-04-04:1642008-04-04T07:05:00Z2008-04-04T07:06:39ZInstalling Tioga on Leopard
<p>Since I do DNA analysis in Ruby, I wanted to be able to make some nice graphs for my data. Enter <a href="http://tioga.rubyforge.org/">Tioga</a>, a Ruby library originally created by "Bill Paxton, one of the creators of Adobe PostScript". Needless to say, the graphs look <a href="http://tioga.rubyforge.org/real-life/index.html">beautiful</a>.</p>
<p>Anyway, I wasn't able to install it on Leopard. Installing via gem didn't produce a workable Tioga, so I had to do it the old fashioned way:</p>
<pre><code>tar zxf tioga-1.7.tar.gz
cd tioga-1.7
cd split
ruby extconf.rb
</code></pre>
<p>Now, the last command failed with this error message:</p>
<pre><code>checking for zlib.h... no
Error: you should have zlib (including development files) installed to
build and run Tioga. You can get it there:
http://www.zlib.net/
If that doesn't solve your problem, please report it on the Tioga tracker:
http://rubyforge.org/tracker/?group_id=701
</code></pre>
<p>After a lot of debugging, the problem was solved by instead running the following:</p>
<pre><code>hdrdir="/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0" \
ARCHFLAGS="-arch i386" ruby extconf.rb
</code></pre>
<p>Mind you, this is on a Mac Pro, which should otherwise have ARCHFLAGS="-arch x86_64". Moving on, running the rest of the code is a piece of cake.</p>
<pre><code>make
sudo make install
cd ../tests
ruby ts_Tioga.rb
</code></pre>
<p>Ta-da! It should work, and you can start working with Tioga. Enjoy!</p>
thomastag:kjosmoen.org,2008-01-30:1232008-01-30T00:27:00Z2008-01-30T01:49:26ZProject page for TextMate bundles
<p>Well, I finally got a project site up and running, which will be hosting all my code. If there are any bug reports or feature requests, please submit an issue notice there. The project page will, in due time, provide you with proper documentation via the built-in Wiki.</p>
<p>Hopefully, this change will be quite useful. The link:</p>
<p><a href="https://projects.ux.uis.no/projects/show/textmate">https://projects.ux.uis.no/projects/show/textmate</a></p>
thomastag:kjosmoen.org,2008-01-09:1062008-01-09T22:44:00Z2008-01-30T00:26:38ZTemporary Matlab bundle download
<p>Seems way more people than I thought use this bundle. Yay!</p>
<p>The bad part is that I’ve had a series of problems lately. Firstly, the Leopard upgrade went somewhat awry. Turned out that not only did Macports bork the Apache install (SSL issue), but also nuked my configuration files. After being on vacation, about 2000km away from my computer, I lost connection to the server amidst network upgrades at the university. Anyhow, I’m back at working out the kinks of the server setup. I should have everything up and running in not too long.</p>
<p>In the mean time, here’s revision 140 of the <a href="http://kjosmoen.org/assets/2008/1/9/Matlab.tmbundle.zip">Matlab.bundle</a>. There may be some issues in the “enter in string” command, which turned out to be much more difficult than imagined. Hopefully, I’ll have the new version done fairly soon. There are a number of new features, such as func⇥, more advanced fun⇥, and ⌃⇥ to fill in variable descriptions in the function snippets. I’ll detail these changes later on, when all is back to normal.</p>
<p>For now, please enjoy the bundle, and let me know if you find bugs or if you have any suggestions!</p>
thomastag:kjosmoen.org,2007-06-15:202007-06-15T13:16:00Z2008-01-29T23:56:03ZBugfixes In The TextMate MATLAB Bundle
<p>As a result of feedback, I have commited a few bug fixes for the MATLAB bundle.</p>
<p>Changelog:</p>
<pre><code>* Added handling of curly brackets.
* Added trigging on Enter in curly brackets.
* Removed automatic conversion of != to ~=. Highlighting as error instead.
* Minor changes
</code></pre>
<p>I should also mention that hitting the Return key, or is it the Enter key? Eh, anyway, the enterish key on the numpad should automatically indent and insert a new % if hit within a comment! This can be very useful if you have to write multi-line comments.</p>
thomastag:kjosmoen.org,2007-05-02:152007-05-02T13:58:00Z2008-06-18T07:10:38ZInstalling the comment notifier plugin in Mephisto<p>After some work, this was what I had to do to install the notifier plugin.</p>
<p>There are two different plugins, and I ended up using the one from <a href="http://opensource.agileevolved.com/svn/root/rails_plugins/mephisto_comment_notification">agileevolved</a> after struggling for a long time with the other available notifier plugin.</p>
<p>If this is useful to you, read on...</p>
<p>After some work, this was what I had to do to install the notifier plugin.</p>
<p>There are two different plugins, and I ended up using the one from <a href="http://opensource.agileevolved.com/svn/root/rails_plugins/mephisto_comment_notification">agileevolved</a> after struggling for a long time with the other available notifier plugin.</p>
<p>If this is useful to you, read on...</p>
<p>Some of these steps are probably not necessary, but I'll include them anyway.</p>
<ol>
<li>Change Mephisto from the stable branch to the trunk.<pre><code>svn switch --relocate \
http://svn.techno-weenie.net/projects/mephisto/branches/stable-0.7 \
http://svn.techno-weenie.net/projects/mephisto/trunk</code></pre></li>
<li>Update rails. <pre><code>rake rails:freeze:edge TAG=rel_1-2-3
rake rails:update</code></pre></li>
<li>Update the Mephisto installation.<pre><code>svn update</code></pre></li>
<li>Migrate the database. If this fails in the migration, remove the notifyer plugin, and try again.<pre><code>rake db:migrate</code></pre></li>
<li>Check out the plugin.<pre><code>mkdir vendor/plugins/mephisto<em>comment</em>notification
cd vendor/plugins/mephisto<em>comment</em>notification
svn co http://opensource.agileevolved.com/svn/root/rails_plugins/\
mephisto<em>comment</em>notification/trunk/ .
cd ../../../</code></pre></li>
<li>Edit your config/environment.rb file to include the email config, as follows. If you need to use username and password, uncomment the last three lines. You can put this in the end of the file.<pre><code>ActionMailer::Base.smtp_settings = {
:address=>'smtp.mydomain.com', # default: localhost
:domain=> 'mydomain.com',
:port=>'25' # default: 25
#:user_name=>'username',
#:password=>'password',
#:authentication=>:plain # :plain, :login or :cram_md5
}</code></pre></li>
<li>Restart your rails server, and you should be good to go.</li>
</ol>
<p>I think this should do it, but if there are any missing steps here, please let me know.</p>
thomastag:kjosmoen.org,2007-03-28:62007-03-28T15:22:00Z2008-01-29T23:56:41ZNew MATLAB Bundle for TextMate<p>Unhappy with the <a href="http://www.mathworks.com/products/matlab/">MATLAB</a> bundle that was included in <a href="http://macromates.com">TextMate</a>, I set out to write a new one. The old one was a mashup of Bash, Octave, MATLAB, and some other stuff, which, needless to say, didn't quite measure up. So, without further ado, you can now download the new and improved <a href="http://svn.screamster.com/websvn/dl.php?repname=kjosmoen&path=%2FTextMate%2FMatlab.tmbundle%2F&rev=0&isdir=1">MATLAB bundle</a>!</p>
<p>Unhappy with the <a href="http://www.mathworks.com/products/matlab/">MATLAB</a> bundle that was included in <a href="http://macromates.com">TextMate</a>, I set out to write a new one. The old one was a mashup of Bash, Octave, MATLAB, and some other stuff, which, needless to say, didn't quite measure up. So, without further ado, you can now download the new and improved <a href="http://svn.screamster.com/websvn/dl.php?repname=kjosmoen&path=%2FTextMate%2FMatlab.tmbundle%2F&rev=0&isdir=1">MATLAB bundle</a>!</p>
<p>As time goes by, I'll most likely submit the bundle for inclusion in the official TextMate distribution, but I want to add some more features, as well as bugfixes. Since I don't have <a href="http://subversion.tigris.org/">Subversion</a> access to the <a href="http://macromates.com/svn/Bundles">bundle repository</a>, it will be much easier for me to develop in <a href="http://svn.screamster.com">my own svn repository</a>. So if you're using this bundle, please let me know if you find any bugs or if you have some requests.</p>
<p>Here's a tiny recap of the features which you'll find in this bundle. First of all, plenty of syntax highlighting goodies! (As long as you use a theme which has defined all the different colors.) Not only are a bunch of new scopes recognized, but it will also mark invalid code for you! Such as invalid variable names, improper use of quotes, etc. It will also highlight strings, transposes, operators, and numbers.</p>
<p>I have also added the complete functions list provided by Mathworks. If you find some functions that you find missing, please let me know and I'll add them. At some point, I may add the option of scanning and adding your private functions to the highlighting, but this won't be done any time soon.</p>
<p>In this bundle, you'll find quite a few <a href="http://macromates.com/textmate/manual/snippets">snippets</a> such as figure operations (set, get, xlabel, ylabel, zlabel, xtick, ytick, line, subplot, title). For instance, if you hit "sub" followed by tab, TextMate will insert
subplot(rows,cols,current),
giving you the option of tabbing through the variables. The next time you invoke subplot, it will pre-populate the function, as well as automatically increment the current plot variable. Nifty!</p>
<p>Other useful snippets include if, if else, for, while, unix, clear, exp, ^. Also, there are several snippets for writing functions. If you type "fun", you will see</p>
<pre><code>function [Output variables] = functionName(Input variables)
% FUNCTIONNAME Short description
%
% Long description
%
% SYNTAX
% [OUTPUT VARIABLES] = FUNCTIONNAME(INPUT VARIABLES)
%
%
% Created by Thomas Kjosmoen on 2007-03-28.
% Copyright (C) University of Stavanger. All rights reserved.
%
</code></pre>
<p>but obviously pre-populated with <em>your</em> name and organization. The help information here will be automatically filled in as you enter the function and variable names. This has saved me a lot of time, as well as letting me use a standardized help information for all my MATLAB functions. There are also, of course, snippets for things such as warnings, errors, disp, sprintf, fprintf, and BSD and GPL license information. Help with function names has also been added. Hit ^H (control-h), and you'll get the online MATLAB function reference.</p>
<p>While I'm focusing on the output functions, I should also mention that we now have more advanced features when dealing with strings. For instance, if you're inside a string such as</p>
<pre><code>a = 'hurray for matlab'
</code></pre>
<p>and you realize that you need to split this up in several lines, just hit enter! You will then automagically get</p>
<pre><code>a = ['hurray for ' ...
'matlab']
</code></pre>
<p>and the string will be properly recognized by MATLAB. (This "..." will also be automatically inserted if you hit enter in a regular matrix or parentheses.) Let's say you want to add a number to that, using the variable "foo"</p>
<pre><code>a = [ foo 'times hurray for ' ...
'matlab']
</code></pre>
<p>As you might know, you now have to convert the variable "foo" to a string; just hit the quotes character " and you'll get</p>
<pre><code>a = [ num2str(foo) 'times hurray for ' ...
'matlab']
</code></pre>
<p>Couldn't be easier ;-) </p>
<p>The last feature I'd like to point out, is the drag and drop features. If you drag an image into TextMate, you'll get something like this</p>
<pre><code>image = imread('../../../Desktop/imagename.jpg');
</code></pre>
<p>with tab-stops in all the right places. Also, if you drag a MATLAB .mat file, you'll get</p>
<pre><code>variable = load('../../../Desktop/filename.mat');
</code></pre>
<p>I hope you find these features useful, and <em>please</em> let me know if you like or dislike something, if you have wishes, or if you find bugs.</p>
thomastag:kjosmoen.org,2006-11-21:52006-11-21T01:55:00Z2006-11-21T02:11:13ZNew design
<p>Hurray! My brand, spanking, shining new design is up and running. Hopefully, there won’t be too many bugs. Let me tell you, working around the heap of bugs that constitute the web browser called Internet Explorer, is <strong>not</strong> fun. In any case, the theme should look decent from IE 6 and up. IE 5.0 is just too broken to bother with, and no sane person should be running that anyway. I’ve tested the design in Opera 9, Firefox 2, Safari 2, ELinks 0.9.2, IE 5, IE 5.5, IE 6, and IE 7.</p>
<p>If you see something that looks like a theme bug, please let me know! Maybe I’ll release this theme some day, if people really want it, but for now, it feels good having a theme that nobody else has. ;-)</p>
<p>In dealing with my new theme, i found that I had to modify the LaTeX plugin somewhat. Here is the updated <a href="http://kjosmoen.org/assets/2006/11/21/latex_renderer2.patch">patch</a>.</p>
thomastag:kjosmoen.org,2006-11-07:32006-11-07T00:33:00Z2007-03-28T19:18:50ZMephisto LaTeX plugin patch
<p>After a reinstall of <a href="http://mephistoblog.com">Mephisto</a> everything’s back up and running as it should. Now, back on topic.</p>
<p>When researching the available blogging softwares, I ran across Mephisto in an attempt of finding myself a <a href="http://rubyonrails.org">Ruby on Rails</a> based software. One of my primary wishes for my new blog was the ability to easily include [LaTeX] equations in my webpages. The only viable alternative which had LaTeX support was WordPress, which I’ve been told has quite a number of issues. After some inquiring in the <a href="http://freenode.net">#mephisto</a> channel, somebody offered to code up a plugin, and a couple of days later the <a href="http://jw.fi/projects/latexrenderer">LatexRenderer</a> plugin was born.</p>
<p>Excellent as it was, I still wanted more ;) A couple of versions later, the <a href="http://kjosmoen.org/assets/2006/11/7/latex_renderer.patch">LatexRenderer patch</a> was done. The original plugin takes the code as:</p>
<p>< filter : latex ><br />
$x = \frac{-b\pm\sqrt{b^2 - 4ac}}{2a}$<br />
< / filter : latex ></p>
<p>, minus the spaces that is, and renders the equation as an image.</p>
<p>What I added to the plugin was the ability to quickly show the underlying LaTeX source code. Rendering the above equation now gives us:</p>
<div class="latex"><img title="$x = \frac{-b\pm\sqrt{b^2 - 4ac}}{2a}$" src="/images/latex/d3c6aa57985defc610af8846f4ed5ad0.png" alt="$x = \frac{-b\pm\sqrt{b^2 - 4ac}}{2a}$" /></div>
<p>If you click on the equation, the image disappears and the source code appears. Click again, and you’ll get the image back.</p>
<p>I hope somebody will find this a useful feature, and hopefully <a href="http://jw.fi">Jan</a> will include the patch in the official plugin.</p>
thomastag:kjosmoen.org,2006-11-06:12006-11-06T04:09:00Z2006-11-06T04:33:19ZMy first post
<p>ZOMG!!1!one!11!!! FP!!!</p>
<p>OK, the enthusiasm is over now. I’m just happy things are working.</p>