Monday, December 17, 2012

A Structured Foray into LaTeX

I am trying to follow this guide: en.wikibooks.org/wiki/LaTeX/Basics, so I ran sudo apt-get install texlive-latex-base to prep my linux environment for our first realistic steps into Mr. Knuth's word processing apparatus.

Our template.tex file:
% <- this character begins comments

%article is one of any document classs

%we can change the document class to
%   change the appearance of this document
\documentclass{article}

%everything above this line is the preamble
%document is considered an environment
\begin{document}
Hello World!
\end{document}
 
Output of latex template.tex
~/Scripts/LaTeX$ latex template.tex 
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
(./template.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo))
No file template.aux.
[1] (./template.aux) )
Output written on template.dvi (1 page, 232 bytes).
Transcript written on template.log.

Messing with Perl

sub zipper {
    my  ($left, $right)         = @_;
    my @larr                    = @{$left};
    my $lsize                   = @larr;

    my @rarr                    = @{$right};
    my $rsize                   = @rarr;

    if ($lsize != $rsize) {

            die "Array sizes are inequal.";

    }    

 

    my @AoAr;

    for (my $i = 0; $i < $lsize; $i++) {
            push @AoAr, \($larr[$i],  $rarr[$i]), "\n";
    }

    return @AoAr;

}
Earlier I decided to make a zipper subroutine in Perl. So far it works. Results:
$VAR1 = \'Pat';
$VAR2 = \'1';
$VAR3 = '
';
$VAR4 = \'Sean';
$VAR5 = \'2';
$VAR6 = '
';
$VAR7 = \'Dante';
$VAR8 = \'3';
$VAR9 = '
';
$VAR10 = \'Dustin';
$VAR11 = \'4';
$VAR12 = '
';
I also devised a dot product using two maps:
my @dotproduct = map {my $z = $_; map {$z . ' ' . $_}
       @surnames} @names;
Results:
$VAR1 = 'Pat 1';
$VAR2 = 'Pat 2';
$VAR3 = 'Pat 3';
$VAR4 = 'Pat 4';
$VAR5 = 'Sean 1';
$VAR6 = 'Sean 2';
$VAR7 = 'Sean 3';
$VAR8 = 'Sean 4';
$VAR9 = 'Dante 1';
$VAR10 = 'Dante 2';
$VAR11 = 'Dante 3';
$VAR12 = 'Dante 4';
$VAR13 = 'Dustin 1';
$VAR14 = 'Dustin 2';
$VAR15 = 'Dustin 3';
$VAR16 = 'Dustin 4';
Another fine example of bad programming. Now here are some things I should have learned way earlier:
  • Lists are not the same as arrays. Arrays are filled with scalars. Lists have objects of some sort.
  • Lists don't really have a scalar context. It resolves to their last element.
  • Changing from an array reference to an array is way too clunky. Is there a better way?

Tuesday, October 23, 2012

How to Run Minecraft Forge on Ubuntu Client and Server

What I'm using as a client

  • Ubuntu 12.04 (Precise)
  • Minecraft Client 1.3.2
  • Minecraft Forge 4.2.5.303 (Link here)

Client steps

  1. Create a backup copy of the installed copy of ~/.minecraft/bin/minecraft.jar
  2. Create a temporary directory "mc"
  3. Copy your installed copy of minecraft at ~/.minecraft/bin/minecraft.jar to mc
  4. cd inside mc, then run jar -xf minecraft.jar
  5. rm minecraft.jar
  6. nautilus ..
  7. Open the minecraft forge file 
  8. Extract all the minecraft forge files into mc, they will overwrite files
  9. Run jar -cf minecraft.jar .
  10. nautilus .
  11. Open minecraft.jar and delete META-INF/ now
  12. mv minecraft.jar ~/minecraft/bin/minecraft.jar
  13. Start minecraft from your minecraft loader (confusingly also named minecraft.jar)
  14. If you receive a pop-up saying something like, "FML needs to setup your environment," then all is well.
  15. Put mods into the generated ~/.minecraft/mods directory.

Server steps

  1. Create a backup copy of the installed minecraft_server.jar
  2. Copy the minecraft_server.jar locally into a temporary directory "mc"
  3. Make sure its empty from the client jar.
  4.  jar -xf minecraft_server.jar
  5. rm minecraft_server.jar
  6. nautilus ..
  7. Open the minecraft forge file
  8. Extract all the minecraft forge files into mc, they will overwrite files
  9. Now, you will keep the META-INF/manifest
  10. jar -cmf META-INF/MANIFEST.MF minecraft_server.jar
  11. Put the minecraft_server.jar back onto your server and copy it over your installed minecraft_server.jar. It's a good idea to do a cksum on your local computer and on the server to make sure nothing was lost in transfer.
  12. You should be able to run your server as normal. Run it once, then put your mods in the generated mods/ directory.