Mar 17

The Best Action Movie Ever

I just re-watched Transporter 2, and I came up with the best idea ever for an action movie.  Well, technically I came up with it a few days or weeks ago, but now seems like a good time to post.

What if we took Vin Diesel and Jason Statham and put them in a movie together?  It’d be two hours of beating other people up.

After all, most of their movies seem to follow the same basic plot.  Guy goes on a mission/people are coming to get him.  He beats them up.  End of story.  I’m looking at you, Riddick and Transporter.

If we want to throw in more bald people in there, throw Bruce Willis in as well.  That would be a great trio right there.

Of course, I have a feeling that the movie would have no plot.  But then again, you have three guys beating up other guys, so what plot needs to be there? 😛

(also, relevant XKCD)
Feb 27

What we dream

So I had a funny dream last night.

For some reason, I was thinking of the song Tubthumping by Chumawamba(a.k.a. I get Knocked Down).  This morning, shortly I woke up, I had a dream about part of the song.  Only some of the lyrics were replaced.  The best way to describe it is when the woman sings “Pissing the night away / pissing the night away” I replaced the lyrics with “I believe in the darkness / I believe in the light”.  Only a little happier.  And it was also sung by a woman with long pink hair in WWII-era uniform.  She was in the bar from Band of Brothers next to Carwood Lipton.

This brings up a good question: what do we dream?  Do we have full lifetimes in our dreams?  There is one person that I can remember(though sadly I can’t remember who at this point) who had a years-long dream and was in the middle of writing it down when he was interrupted.  Can we all have dreams like this?  It reminds me of the Batman Beyond episode where people were addicted to a virtual reality simulation.

Anyway, that’s the random thought of the day.

Jan 18

CGI in Movies

Last night, I went to see The Hobbit: The Desolation of Smaug, and it got me thinking about the CGI that was used.  Not just in The Hobbit, but in the previews as well.  There was a preview for The Amazing Spiderman 2, and almost the entire trailer was CGI clips.  Now don’t get me wrong, CGI can be used to do some great shots.  However, the problem as I see it is that it can be greatly over-used.

On some movies, this can be an intentional choice.  Such as in Sky Captain and the World of Tomorrow, where pretty much the entire movie was CGI – this works in my opinion.  However, when you need to mix CGI and live-action seamlessly, there can be a tendency more to be lazy with the live-action.  Before CGI, miniatures had to be made for everything, and miniatures almost always look better than CGI.  Granted, these shots probably used CGI to cut two shots together, but in my mind this is an acceptable use of CGI.  Creating an entire scene seems lazy.

The reason that I found The Hobbit to have a lot of CGI is because most of the movie that was inside the lonely mountain was CGI.  Everything just seemed too perfect.  The gold coins seemed all flat, Smaug was sitting on  a ridiculously large pile of gold, among other things.  I will paraphrase The Hobbit book here, from memory:

A constant stream of smoke came out of the gate.

I never got this feeling from the movie; everything still seemed as though the dwarves had left the lonely mountain and nothing had really changed.

To conclude, I think that this video shows what I’m talking about well; there are CGI elements, but it’s used more to tie two real shots together.  Because of this, it really shows better what is going on, and everything seems more realistic.  One of the problems with CGI as I see it is that everything seems too perfect; this is partly because of how the light is reflecting off of objects.  Most of the time, everything seems too bright.  The rest of the time, it generally feels off because the laws of physics seem to be broken; miniatures still have to follow the laws of physics.

Thoughts on the FSF

Aside

I think this really points out my thoughts on the FSF the best.  Not that the FSF is bad in any way, or it doesn’t do useful stuff, but they seem to be living in the past.  I guess perhaps the point here is that if you don’t know what’s out there, and how things are used, it’s impossible to make things better.  It’s like creating software for a problem that you don’t understand, or writing a book.  You must first understand what the rules are, how people use them, and then you can create a better solution.

Nov 07

Thoughts on systemd

So the other day, I had to figure out if udev is still supported without using systemd, since the source trees have been merged, and we’re using Ubuntu at work which doesn’t use systemd. (answer: yes)  This research brought me to this systemd comparison page, detailing the differences between sytemd, Upstart, and SysV.  Not knowing much about init systems(besides Upstart and a little bit of SysV), systemd seems to have a lot of features in it – but as I’m reading these features, I’m wondering: should an init system do all of these things?

There seem to be a lot of things which aren’t particularly useful.  But perhaps they are(as I said, I’m not an expert on init systems).  They seem to be creating a particularly complicated system, and it seems to me that many of the features that they espouse could just as easily be handled by a separate program.  Of course, having a separate program does have its downsides, since it can make the startup logic more obtuse.

Also, I really like how in the ‘Miscellaneous’ table there’s a row for the SCM that is used.  I’m thinking “Who the hell cares?”.

Nov 01

Monitor System DBus

I’m currently writing a program which needs to listen to signals on the system DBus, and I needed a way to monitor the system bus.  I followed the directions here, but I came across a slight problem with that.  It turns out that the solution posted only allows you to listen for things that root sends out.  When I ran my program as an unprivileged user, I didn’t see any output in dbus-monitor, however I would see output if I ran the same program as root.  From what I can tell, the configuration posted will only allow you to see what root is sending on the bus, given that user=”root”.

Fortunately, there’s a simple fix for this:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE busconfig PUBLIC
  "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">

<busconfig>
  <policy context="default">
    <!-- Allow everything to be sent -->
    <allow send_destination="*" eavesdrop="true"/>
    <!-- Allow everything to be received -->
    <allow eavesdrop="true"/>
  </policy>
</busconfig>

Simply change the policy user to a policy context, and you can now see everything that’s on the bus.

As always, make sure that you remove this config once you’re done testing, otherwise it will be easy to circumvent security mechanisms that are in place.

Sep 03

Good Documentation

I just came across this post on Slashdot on how to create good documentation.  This is a good guide.  Too often, documentation that exists out there is not particularly great, or good at showing you how to do something.  This is the reason that I created my D-Bus tutorial – and I hope that it’s been useful to people.  Similar to how Log4J2 didn’t have excellent documentation – it makes sense once you know how things work, but there isn’t a nice, low-knowledge way to go about this.  In fact, right in the documentation it says:

An understanding of how loggers work in Log4j is critical before trying to configure them. Please reference the Log4j architecture if more information is required. Trying to configure Log4j without understanding those concepts will lead to frustration.

…and that’s about the point at which my eyes glaze over.

I’m not saying that the Log4J2 documentation is horrible, but it could be better and somewhat more structured as Steve Losh said.

Aug 22

Log4J2 Setup

I feel that a decent guide on how exactly Log4J2 is setup is in order, because there isn’t a real clear explanation on Apache’s site. Now Apache, I know you guys make a lot of stuff, but seriously a lot of this stuff is just over-engineered.

Alright, on to the configuration stuff!

Here’s an example config file, with an explanation as to what is going on here(at least as far as I can understand it)

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="OFF">
  <appenders>
    <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
    </Console>
    <File name="File" fileName="${sys:logFilename}">
      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
    </File>
  </appenders>
  <loggers>
    <root level="ERROR">
      <appender-ref ref="Console" />
      <appender-ref ref="File"/>
    </root>
    <logger name="com.rm5248.Logtest2" level="ALL" />
  </loggers>
</configuration>

Okay, let’s start at the very top with the configuration tag:

<configuration status="OFF">

If you change the ‘status’ part of this to a level such as “ALL”, you’ll notice that Log4J2 sends out A LOT of information. As far as I can tell, this is just logging information that is part of Log4J2.

Alright, let’s go on to the appenders. When you create a logger, there are several appenders that you can use to send information to various places. The two appenders that we have here are for the console(i.e. System.out) and a file.

<appenders>
    <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
    </Console>
    <File name="File" fileName="${sys:logFilename}">
      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
    </File>
  </appenders>

The PatternLayout that they have determines how the information will be printed out. For the File appender, there is a fileName property with sys:logFilename. This means that the logger will look for the system property of logFilename. This can be set by either:

  1. passing -DlogFilename=XXX to the program
  2. System.setProperty( “logFilename”, XXX )

If you use option #2, you must also reconfigure the logger as shown in this StackOverflow post.  Fortunately, the patters are in fact well documented.  There are a lot of other appenders out there to append to different things, but we’re not worried about that at the moment.

Okay, now on to the final section: the loggers themselves.

  <loggers>
    <root level="ERROR">
      <appender-ref ref="Console" />
      <appender-ref ref="File"/>
    </root>
    <logger name="com.rm5248.Logtest2" level="ALL" />
  </loggers>

As you can see here, we have a root logger and a specific logger.  The root logger has a level of ERROR, which means that everything descending from the root logger will print out all ERROR messages.  The root logger will also go two places: the Console logger and the File logger.

The second logger besides the root logger is logging just one specific file.  The log level for that file is ALL, which overrides the ERROR log level of the root logger.  Thus, all log messages from that file will be logged.  These messages will also be sent to both the CONSOLE log and FILE log, as those settings are inherited from the root logger.  Let’s say that we want to send those log messages to the FILE, but everything will also go to the CONSOLE. We would do something like this:

    <root level="ERROR">
      <appender-ref ref="Console" />
    </root>
    <logger name="com.rm5248.Logtest2" level="ALL" >
       <appender-ref ref="File" />
    </logger>

Since the more specific logger inherits from the root logger, all log messages from com.rm5248.Logtest2 go to the FILE and the CONSOLE.  There’s more stuff that you can do here with that, but I haven’t really delved into it too deeply.

Anyway, here’s the code that I was using when I was playing around with this.  Hopefully this will help you to get started.

XML Config File:

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="OFF">
  <appenders>
    <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
    </Console>
    <File name="File" fileName="${sys:logFilename}">
      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
    </File>
  </appenders>
  <loggers>
    <root level="ERROR">
      <appender-ref ref="Console" />
      <appender-ref ref="File" />
    </root>
    <logger name="com.rm5248.Logtest2" level="ALL" />
  </loggers>
</configuration>

LogTest.java:

package com.rm5248;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.net.URI;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.config.ConfigurationFactory;
import org.apache.logging.log4j.core.config.Configurator;
import org.apache.logging.log4j.core.config.XMLConfigurationFactory;


public class LogTest {

	private static Logger logger = LogManager.getLogger( LogTest.class );

	public static void main( String[] args ){
		File logConfigFile = new File( XML_CONFIG_FILE_GOES_HERE );
		System.setProperty( "logFilename", "filename.log" );		

		try {
			FileInputStream fis = new FileInputStream( logConfigFile );

			XMLConfigurationFactory fc = new XMLConfigurationFactory( );
			fc.getConfiguration(  new ConfigurationFactory.ConfigurationSource( fis ) );

			URI configuration = logConfigFile.toURI();
			Configurator.initialize("config", null, configuration);

			org.apache.logging.log4j.core.LoggerContext ctx =
					(org.apache.logging.log4j.core.LoggerContext) LogManager.getContext( true );
			ctx.reconfigure();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}

		logger.debug( "hi debug" );
		logger.info( "hi info" );
		logger.error( "hi error" );

		Logtest2.doSomething();
	}

}

Logtest2.java:

package com.rm5248;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Logtest2 {
	private static Logger logger = LogManager.getLogger( Logtest2.class );
	
	public static void doSomething(){
		logger.debug( "hello" );
		logger.error( "error?!" );
		logger.warn( "warning" );
		logger.info( "la la la" );
	}
}
Aug 04

What the heck, Discovery?

You guys used to be so good. You had a bunch of interesting shows that really let me learn a lot about the world. And now you do crap like mermaids, and now megalodon shark attacks on boats in South Africa.  WHAT THE FUCK?!  Look, I’m all for being entertained, but when I’m watching Discovery, Animal Planet, heck any channel that is owned by Discovery, I’m not looking for entertainment.  I’m looking to learn.

I think that these shows do have a place in the world.  But when you make shows like these, don’t film them as pseudo-documentaries, or “mockumentaries” as people call them.  They should be about possible things that happen.  You guys should be there to help promote thinking about what is there, and what used to be there.  None of this fake crap that you’re putting out there now – it’s frankly insulting.

I know that you guys make enough money as it is.  This is just retarded that you’re doing something like this.  If you want to do something about megalodon, that’s fine.  Let’s do it in a way that lets people learn about megalodon, like what it could have been like.  Also, I don’t want actors playing biologists or anything, get real biologists out there to tell us this stuff.  You do a great disservice to all of us when there are people pretending to be biologists when they really aren’t.

Also, History Channel, I’m looking at you too.  I don’t really have anything against Pawn Stars or American Pickers, because they can be good shows about showing off items from history.  But when I hear crap like Pawn Stars having an item on the show that is in a museum currently, well, that’s just stupid as well.  Again, not that there’s anything wrong with the show itself per se, but when it’s blatantly obvious that they’re not actually buying or selling anything then we have a bit of an issue here.

TruTV, you’re not so good yourself.  I don’t really watch you anymore.  Except for maybe World’s Dumbest.  That’s actually amusing since it’s not really staged, it’s just people making sarcastic comments and mocking dumb people.