CopyPasteTool

May 21st, 2009 by Andrew Vos

Download it now.

http://www.copypastetool.com/

From the site:

This small tool allows to save several values of text in clipboard and paste them. Use standard keys for copying (CTRL+C) and pasting (CTRL+V) as usual, but if you want to paste previous text in clipboard then simply press V again and don’t release CTRL. It’s free.

Popularity: 3% [?]

Posted in Software, Tools having 1 comment »

Derek

May 12th, 2009 by Andrew Vos

Did this last night with a friend of mine.

Our first attempt at stop motion.

Popularity: 3% [?]

Posted in Animation, Comedy, Video having no comments »

Snatch Wars

April 22nd, 2009 by Andrew Vos

Popularity: 4% [?]

Posted in Comedy, Video, YouTube having no comments »

Hitler Videos!

January 27th, 2009 by Andrew Vos

I’ve been relatively quiet for a while, so I thought I’d pop in quick and add a couple of Hitler parodies.

(Try watch them when you’re drunk, or else they might not be funny)

 

Adolf Hitler - Vista Problems!

http://www.youtube.com/watch?v=ExeyrNZwzwQ

Hitler Hates Valve

http://www.wegame.com/watch/Hitler_Hates_Valve_4/

Hitler- I want to break free

http://www.youtube.com/watch?v=6ax4jvLM9WI&feature=related

Adolf Hitler rap

http://www.youtube.com/watch?v=5k736WZfB6U

Hitler Finds Out He’s A Joke On YouTube

http://www.youtube.com/watch?v=w9mjEF_lEDE

Popularity: 6% [?]

Posted in Alcohol, Comedy, Video having no comments »

HtmlBuilder 0.1.33

January 15th, 2009 by Andrew Vos

HtmlBuilder is simple web design software, and this is it’s first release.

HtmlBuilder uses a simple template system, and includes some example templates under Help/Example Projects.

The HtmlBuilder Main Window

On the left we have the Site browser, which lists all files in the site.

HtmlBuilder Main Window

The Color Chooser Window

Favorite colors can be stored on the right hand side.

HtmlBuilder Color Chooser

Requirements

.NET Framework 3.5

Downloads

Version 0.1.33

Changes

Version 0.1.33 (January 15th 2009)

Added some DTD’s to the Insert/DTD Menu.

Version 0.1.3 (January 14th 2009)

First Release.

Popularity: 6% [?]

Posted in .NET Framework, C#, Code Projects, Coding, Download, Downloads, HtmlBuilder, News, Software, Web Design having no comments »

Getting music from iTunes to your G1

January 9th, 2009 by Andrew Vos

I wanted to export all my music from iTunes to my G1, but I wanted to maintain the folder structure like this:

Artist\Album\TrackName.mp3

Couldn’t find anything on Google so here’s some C# code to get it done. Remember to add a reference to iTunesLib (Add Reference / COM).

   1: private static class ITunesExporter{
   2:   public static void Export(string playlistName, string path) {
   3:     iTunesAppClass iTunes = new iTunesAppClass();
   4:  
   5:     foreach (IITPlaylist playlist in iTunes.LibrarySource.Playlists) {
   6:       if (playlist.Name == playlistName) {
   7:         foreach (IITTrack track in playlist.Tracks) {
   8:           if (track.Kind == ITTrackKind.ITTrackKindFile) {
   9:             IITFileOrCDTrack file = (IITFileOrCDTrack)track;
  10:             string extension = Path.GetExtension(file.Location);
  11:             string newPath = ITunesExporter.createValidFileName(path, file.Artist, file.Album, file.Name, extension);
  12:             string newDirectoryName = Path.GetDirectoryName(newPath);
  13:             Directory.CreateDirectory(newDirectoryName);
  14:             
  15:             if (File.Exists(newPath) == false) {
  16:               File.Copy(file.Location, newPath);
  17:             }
  18:           }
  19:         }
  20:       }
  21:     }
  22:   }
  23:   private static string createValidFileName(string exportPath, string artist, string album, string track, string extension) {
  24:     artist = ITunesExporter.removeInvalidFileNameCharacters(artist);
  25:     album = ITunesExporter.removeInvalidFileNameCharacters(album);
  26:     track = ITunesExporter.removeInvalidFileNameCharacters(track);
  27:  
  28:     string filePath = exportPath;
  29:     filePath = Path.Combine(filePath, artist);
  30:     filePath = Path.Combine(filePath, album);
  31:     filePath = Path.Combine(filePath, track);
  32:     filePath = Path.ChangeExtension(filePath, extension);
  33:     return filePath;
  34:   }
  35:   private static string removeInvalidFileNameCharacters(string str) {
  36:     char[] chars = Path.GetInvalidFileNameChars();
  37:     foreach (char c in chars) {
  38:       str = str.Replace(c.ToString(), null);
  39:     }
  40:     return str;
  41:   }
  42: }

You can use the code like this:

   1: ITunesExporter.Export("Phone", @"D:\Music");

”Phone” is the playlist name and “D:\Music” is the path that the files will be exported to.

If anyone want’s to recode it to use the iTunes XML file please post the code! (I am to lazy).

Popularity: 6% [?]

Posted in .NET Framework, C#, Code Projects, Coding, Mobile, Music, iTunes having no comments »

object.Format Extension

January 7th, 2009 by Andrew Vos

EDIT: I’ve added the string extension found here

I was reading an article on haacked today, called Fun With Named Formats, String Parsing, and Edge Cases and I started thinking what if I made a format extension method for an object which used reflection to get the properties.

The following example:

private static void test() {
  CultureInfo southAfrican = CultureInfo.CreateSpecificCulture("en-ZA");

  var human = new {
    FirstName = "Andrew",
    LastName = "Vos",
    BirthDate = new DateTime(1983, 10, 23),
    MoneyInPocket = 123.34
  };

  string formatted = human.Format(southAfrican,
    "Hello my name is {FirstName}, and my last name is {LastName}.\n" +
    "My birth date is {BirthDate:D}\n" +
    "I have {{MoneyInPocket:C}} in my pocket right now.\n" +
    "Here are some random chars... { { } }{ {} {}{} }{ {} " +
    "\nThis last value fails because there's no corresponding property: {TheLastValue}."
    );
  Console.WriteLine(formatted);
}

 

Would result in the following output:

Hello my name is Andrew, and my last name is Vos.
My birth date is 23 October 1983
I have {R 123.34} in my pocket right now.
Here are some random chars... { { } }{ {} {}{} }{ {}
This last value fails because there's no corresponding property: {TheLastValue}.

 

Here’s the code:

internal static class ObjectFormatter {
  /// <summary>Formats the string by replacing format items with the objects properties.</summary>
  /// <param name="obj">The <see cref="T:System.Object"></see> to format.</param>
  /// <param name="format">A <see cref="T:System.String"></see> containing the format items.</param>
  /// <returns>A copy of format where the format items have been replace by the corresponding properties.</returns>
  /// <exception cref="T:System.ArgumentNullException">format or obj is null.</exception>
  internal static string Format(this object obj, string format) {
    return ObjectFormatter.Format(obj, null, format);
  }

  /// <summary>Formats the string by replacing format items with the objects properties.</summary>
  /// <param name="obj">The <see cref="T:System.Object"></see> to format.</param>
  /// <param name="provider">An <see cref="T:System.IFormatProvider"></see> that supplies culture-specific formatting information.</param>
  /// <param name="format">A <see cref="T:System.String"></see> containing the format items.</param>
  /// <returns>A copy of format where the format items have been replace by the corresponding properties.</returns>
  /// <exception cref="T:System.ArgumentNullException">format or obj is null.</exception>
  internal static string Format(this object obj, IFormatProvider provider, string format) {
    if (format == null) throw new ArgumentNullException("format");
    if (obj == null) throw new ArgumentNullException("obj");

    const string propertyPattern = @"\{(?<PropertyName>[a-z,0-9,_]+)\:?(?<PropertyFormat>[^}]+)?\}";
    MatchCollection matches = Regex.Matches(format, propertyPattern,
      RegexOptions.Compiled |
      RegexOptions.CultureInvariant |
      RegexOptions.IgnoreCase);

    foreach (Match match in matches) {
      string propertyName = match.Groups["PropertyName"].Value;
      string propertyFormat = match.Groups["PropertyFormat"].Value;
      PropertyInfo propertyInfo = obj.GetType().GetProperty(propertyName);

      if (propertyInfo != null) {
        object propertyValue = propertyInfo.GetValue(obj, null);
        string propertyString = null;

        if (propertyValue != null) {
          propertyString = string.Format(provider, "{0:" + propertyFormat + "}", propertyValue);
        }
        format = format.Replace(match.Value, propertyString);
      }
    }

    return format;
  }
}
internal static class StringObjectInjector {
  /// <summary>Formats the string by replacing format items with the objects properties.</summary>
  /// <param name="format">A <see cref="T:System.String"></see> containing the format items.</param>
  /// <param name="obj">The <see cref="T:System.Object"></see> to format.</param>
  /// <returns>A copy of format where the format items have been replace by the corresponding properties.</returns>
  /// <exception cref="T:System.ArgumentNullException">format or obj is null.</exception>
  internal static string Inject(this string format, object obj) {
    return obj.Format(format);
  }

  /// <summary>Formats the string by replacing format items with the objects properties.</summary>
  /// <param name="format">A <see cref="T:System.String"></see> containing the format items.</param>
  /// <param name="provider">An <see cref="T:System.IFormatProvider"></see> that supplies culture-specific formatting information.</param>
  /// <param name="obj">The <see cref="T:System.Object"></see> to format.</param>
  /// <returns>A copy of format where the format items have been replace by the corresponding properties.</returns>
  /// <exception cref="T:System.ArgumentNullException">format or obj is null.</exception>
  internal static string Inject(this string format, IFormatProvider provider, object obj) {
    return obj.Format(provider, format);
  }
}

Popularity: 7% [?]

Posted in .NET Framework, C#, Code Projects, Coding having 2 comments »

ShellContextMenu2

January 6th, 2009 by Andrew Vos

Here’s a refactored version of the ShellContextMenu code I released a while back. It has been converted to C# and the code is much better.

A shell context menu is the shortcut menu you see when right clicking on a file in Explorer.

Shell Context Menu

Download the code here

Popularity: 7% [?]

Posted in .NET Framework, C#, Code Projects, Coding, Download, Downloads having 2 comments »

Fuuuuuuuuck

December 31st, 2008 by Andrew Vos

Popularity: 6% [?]

Posted in Comedy, Video having no comments »

PasswordMaker

December 30th, 2008 by Andrew Vos

Check out PasswordMaker, a simple little script that codes simple passwords into slightly more complex passwords.

PasswordMaker

The encoder uses the simple Caesar Shift Cypher.

Popularity: 6% [?]

Posted in Coding, Javascript, PasswordMaker, Web 2.0, Web Design, Web Software having no comments »