JoelDixon.com

"Weaseling out of things is important to learn. It's what separates us from the animals ... except the weasel." - Homer Simpson, The Simpsons 1F06

Blog
General
Travel
Hockey
Technical
Gaming
Catalogue
Movies
TV Shows
Music
Video Games
Stats
Pages
Travel Plans
Live Music
Phone History
Monument Mounting
Things to Do
Links
About


Blog Archive
Current Blogs
April 2017 (3)
March 2017 (1)
July 2016 (1)
2015 (24)
2014 (1)
2013 (4)
2012 (39)
2011 (2)
2010 (18)
2009 (28)
2008 (25)
2007 (67)
2006 (23)
2005 (32)
2004 (10)

Blog Tags
General (13)
10 in '10 (4)
Books (1)
DVDs (3)
Funny (13)
Gadgets (5)
Hawt (1)
Movies (14)
Music (7)
Pets (4)
Recipe (17)
Running (3)
TV Shows (2)
Web (29)

Travel (75)
Akihabara (1)
Amsterdam (1)
Argentina (2)
Asakusa (1)
Barcelona (1)
Berlin (1)
Brussels (1)
Budapest (1)
Buenos Aires (1)
Cairo (1)
Calgary (2)
Cusco (1)
Dijon (1)
Dresden (1)
Edinburgh (1)
Edmonton (12)
Florence (1)
Gero (1)
Ginza (1)
Harajuku (1)
Himeji (1)
Hiroshima (1)
Iga (1)
inca-trail (1)
Ireland (1)
Japan (22)
Kamakura (1)
Kawaguchiko (1)
Killarney (1)
Kobe (1)
Krakow (1)
Kuala Lumpur (1)
Kyoto (1)
Lima (1)
Lisbon (1)
London (1)
Lyon (1)
Madrid (1)
Meguro (1)
Milan (1)
Montreal (1)
Nagoya (1)
Naples (1)
Nara (1)
New York (8)
Niagara Falls (3)
Nice (1)
Nikko (1)
Nile Cruise (1)
Odaiba (1)
Osaka (1)
Ottawa (1)
Paris (1)
Phuket (2)
Pittsburgh (8)
Porto (1)
Prague (1)
Provins (1)
Quebec City (1)
Rome (1)
Sakura (1)
Shibuya (1)
Shinjuku (1)
Takayama (1)
Toledo (1)
Toronto (1)
Ueno (1)
Valencia (1)
Vancouver (1)
Venice (1)
Vienna (1)
Warsaw (1)
Washington (4)
Whistler (1)
Yokohama (1)

Hockey (3)
Lemieux Fantasy Camp (2)
Pittsburgh Penguins (28)
Wolverines (1)

Technical (4)
.NET (3)
Java (4)
Software (3)
Work (2)

Gaming (6)
Commodore 64 (2)
Master System (1)
Mega Drive (1)
Rock Band (1)
Xbox 360 (16)
XNA (1)

The rarely updated blog of Joel Dixon

Viewing blogs in section Technical

Wednesday, June 29, 2011

Log o' cats

# Posted by Joel Dixon at 29/06/2011 21:52:48

I've been getting a heap of spam comments on my most recent blog post - so I hope that adding a new blog keeps the spammers at bay (if only they knew how small and stingy my readership is).

I've wanted to have an online catalogue of my DVDs and CDs for a while now - mainly so I could answer such important questions as "shit, I know I've seen that guy in something before, what was it?". Some could (and did) suggest that IMDb satisfies this requirement and they would be right. Then I remembered the other reason I have - to stop buying doubles of things at JB Hi-Fi. It is now much easier to check if I already have a certain DVD via my phone while at the "crazy discounts" bin.

I also wanted to pay more attention to writers and directors of films - to better predict whether I would like a new release.

Anywho - I finished it months ago and have filled it with my Movies, TV Shows and Music. I also have Video Games, but haven't been bothered enough to catalogue them all yet.

As usual, I love an elegant URL, so each item or section tries to do away with query strings or arbitrary IDs - which actually took a bit of effort. For example:

All movies: http://www.joeldixon.com/catalogue/movies/

All movies released in 2008: http://www.joeldixon.com/catalogue/movies/2008/

Movies with a genre of romance sorted by my rating: http://www.joeldixon.com/catalogue/movies/genre/romance/sort /rating/

I also calculate some stats (which I hope to expand at some point).

Sure, there's probably an online tool that already does this kind of thing, but certainly not with such attractive and functional URLs!



Comments (2) | Add Comment

Sunday, February 01, 2009

Enum Members and the .NET Compact Framework

# Posted by Joel Dixon at 01/02/2009 16:37:16

When working on my latest weekend coding project, I am occasionally limited by the methods offered (and not offered) by the .NET Compact Framework (XNA projects are compiled against the compact framework). Usually these limitations are pretty minor (i.e. as TryParse is not available, I need to put a try-catch block around a regular Parse call).

Today I stumbled over another unavailable method - Enum.GetNames(). The GetNames method is called when using Reflection to determine, at runtime, the elements in an enumeration. It took a bit of hunting and experimenting - but here's a Compact Framework-friendly method of achieving the same thing:

C# Code:

enum ShakeFlavour
{
Chocolate,
Strawberry,
Vanilla
}

Type type = typeof(ShakeFlavour);

// Print the list of enum elements - Public and Static BindingFlags required
// to skip internal "value__" field
FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Static);
foreach (FieldInfo info in fields)
{
Console.WriteLine(info.Name);
}

// Parse an enum element from a string
string myFlavour = "Strawberry";
try
{
ShakeFlavour enumObject = (ShakeFlavour)Enum.Parse(type, myFlavour, true);
Console.WriteLine("Shake Flavour: {0}", enumObject);
}
catch (Exception ex)
{
Console.WriteLine("enum element not recognised");
}

It's pretty good that Reflection is included in the compact framework - but it's slightly surprising that they couldn't fit in the Enum.GetNames() method as well.



Comments (0) | Add Comment

Saturday, August 18, 2007

Welcome to joeldixon.com - it's the web 0.9

# Posted by Joel Dixon at 18/08/2007 05:19:16

As I stated way back when, I had always figured I would have a blog eventually - but I had originally assumed I would have coded the blog website myself as a programming exercise (being, at that point, new to PHP and MySQL). I originally signed up to Blogger to comment on a few people's blogs, and I started making posts while developing my own Blog website. As is common with other "coding for fun" projects of mine, the process dragged on a lot longer than I had originally thought. It's funny, part of the reason I didn't want to "settle" for Blogger's software was the lack of a few key features I wanted (such as tags, image uploads etc). Sure enough - by the time I had completed my site, Blogger gained most of my wanted features, and more.

But anyway - it's finally finished - and hopefully it will convince me to blog more often while in Edmonton. Some of the key features that I wanted include:

- Descriptive blog post URLs - URLs for my blog entries include the date of publication and title of the blog post (i.e. http://www.joeldixon.com/blog/entry/2007/08/09/day-1-in-edmo nton). I'm often reluctant to click an anonymous blog post when the url is something like http://example.com/blog?entry_id=12 or http://example.com/blog/12). I also wanted, as much as possible, for the URLs to make sense - like http://www.joeldixon.com/blog/archive/2005/page/2.

- Text formatting options - I personally like HTML, so I wanted commenters to be allowed to use (limited) HTML tags, as well as the common BBCode rip-off that most sites provide. This includes image linking for comments, and image uploads for blog posts. Oh - and you gotsa have smilies

- More commenting options - Originally Blogger only allowed members to post with an email or website address. I wanted to provide an option to register to the site (manage your profile, keep track of post count etc) for commenting - but also allow anonymous comments provide a name, email address and home page. Sure, spammers may eventually enjoy this feature - but I can set individual blog posts to require a captcha (generally only 1 in 50 of my old blog posts generated any spam).

- Quick comments and previews - A pretty neat feature I blatantly stole from my little brother (though his is much fancier in terms of animation), I wanted the ability to allow quick comments on blog posts from the main page of the site. Also, I wanted to allow a "Preview" button - mainly because of the number of times I've stuffed up the formatting one one of my blog comments.

- Sections and series and tags - (oh my!) Blog tags are pretty cool, but I also wanted a way to keep my geeky technical and gaming posts separate from the suave travelings of a jetsetter (because, like, there's so much more to me). The home page still shows all sections combined, but I will probably provide an RSS feed for each section if demand requires.

- Recent comments and blog search - Another piece of website thievery, I wanted to be able to see the last five comments or so on my homepage with ease. The blog search is also something that helps when when I think "I know I've typed this before" - though as it was the last feature implemented, it's really dodgy at present.

- Static RSS feed - Most coded-at-home blog sites have a dynamically generated RSS feed that gets created each time it is requested (i.e. I go to the RSS feed's page, it goes to the database to get the last 20 posts then outputs the results as XML). The problem with this approach is that some RSS clients request the XML feed in great frequency to check if anything's been updated. Even with as limited a readership as mine, these requests can add up and really slow down the database. Instead, I've made it so a physical XML file is saved to my website each time a blog post is updated, or a future-dated blog post is made active. This file generation is slower than a simple database request being returned as XML, but if history is anything to go by, my post frequency is nothing to worry about!

I'm probably leaving out heaps of features that took plenty of time and heaps of head scratching, but I'm sure you get the idea.

So register to comment, sign up to the RSS feed and stay a while!



Comments (2) | Add Comment

Wednesday, July 13, 2005

Remember Me! <flaming eyeballs>

# Posted by Joel Dixon at 13/07/2005 11:58:00

Well, my USB key wiped itself again (third time thus far) which is very annoying. I use it to store old work, and common code I'm always looking up. An example of this is VBA code required to unlock a protected Excel workbook (for whenever I want the answers to the latest Excel Quiz doing the rounds):

VBA Code:

Sub PasswordBreaker()
'Author unknown
'Breaks worksheet password protection.
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
If ActiveSheet.ProtectContents = False Then
MsgBox "One usable password is " & Chr(i) & Chr(j) & _
Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub

I've decided to start posting things like that here - and use my USB key for transport rather than storage.



Comments (0) | Add Comment

Sunday, July 10, 2005

Checkers

# Posted by Joel Dixon at 10/07/2005 23:33:00
Updated by Joel Dixon at 21/12/2012 22:26:03


Going through some of my old uni work, I found my Checkers assignment. It's not very good - but I like the look of it. I've stuffed up the Game Tree Algorithm though - as the computer plays good for the first half of the game, then it tries to let me capture it's pieces.

Oh well, enjoy.



Comments (0) | Add Comment

Friday, June 17, 2005

Java Snob

# Posted by Joel Dixon at 17/06/2005 17:52:00
Updated by Joel Dixon at 21/12/2012 22:33:21


Java has been my programming language since my first year at university (1999). Before Uni I had toyed with Basic, Turbo Pascal and VBA (Visual Basic behind Access / Excel) for VCE, but my largest programming experience was Batch files on our home computer.

I really took to Java at uni, and programmed a few things in my own time (a calculator and text editor). When I started my graduate job I was put on a Java maintenance project, which I enjoyed a lot for the first few years. Since then, I have also been toying with my shape drawing program in my spare time - which I also enjoy.

I haven't coded much Java lately, as I've been doing .NET work and recently been on a BizTalk Server course which I enjoyed thoroughly. Tonight I decided to play with my shape drawing program and try to get some work done. So I started JBuilder and couldn't start - I've been spoiled by Visual Studio, and .NET development.

JBuilder's Form Designer is shite - and wiring up event processing is tiresome. The IntelliSense was also limited compared to what I've been used to. A mate from work was saying that .NET development was very enjoyable - I'm starting to understand why.

So I've closed by JBuilder - and I'm not sure if I'm going to opening it again from home. Perhaps more Java projects at work will change my mind - but for now I think I'll be happy with .NET.

Unless there's a client that wants an MS-DOS Batch File solution



Comments (0) | Add Comment

Thursday, April 07, 2005

ADO.NET Strongly Typed Relationships

# Posted by Joel Dixon at 07/04/2005 01:55:00
Updated by Joel Dixon at 21/09/2007 04:03:35 - added comment captcha


It's been over a month since my last blog - but that's OK - I'm sure no-one will mind!

I've decided to add a little technical advice about accessing data with Strongly Typed DataSets in ADO.NET. Reason being, I spent over an hour looking for this information before I finally tracked it down on someone's blog. After my post, it will double the amount of blogs with this information

In my ASP.NET WebService, I like to use strongly typed DataSets to access my data with ADO.NET, it's a whole lot cleaner that way. For my example, let's say we have a Customers table, and an Orders table. Customers are identified by their CustomerID, and orders by their OrderID (yes, I'm using Northwind). The Orders table also has the CustomerID that made the order (a one to many relationship). Defining the strongly typed DataSet for this in Visual Studio.NET is quite easy:

  1. Right-click your Project in the Solution Explorer and select Add > Add New Item...
  2. Select "Data Set" from the Templates list, and type the name for your item (CustomersDataSet.cs).
  3. In the Server Explorer, navigate to the Northwind database tables. Drag across the Customers and Orders tables.
  4. Select the Customers table and select Schema > Add > New Relation... from the File Menu.
  5. This is where your relationship is defined. Change the name to CustomersOrders, and change the Child element to Orders. Clicking OK will then create the relationship for you.

Now that you have the strongly typed DataSet, you can directly refer to column names. For example, instead of:

Code:

DataSet1.Tables["Customers"].Rows[0]

you can use:

Code:

DataSet1.Customers[0]

That was all good - but I wanted to look at the Orders that are assigned to a Customer (as per the relationship I added above). Most examples were telling me to do something like this:

Code:

CustomersDataSet.CustomerDataRow customer
= myDataSet.Customers.FindCustomerByID(1);
if (customer != null)
{
// Print out order numbers
foreach (DataRow orderRow in
customer.GetChildRows("CustomerOrders"))
{
Console.WriteLine(orderRow["OrderID"]);
}
}

This gets the job done - but we're back to using things like orderRow["OrderID"] instead of orderRow.OrderID. The disadvantage to using GetChildRows is that it returns an array of DataRow's - not Orders. A way to achieve the above code using your strongly typed relationship is as follows:

Code:

CustomersDataSet.CustomerDataRow customer
= myDataSet.Customers.FindCustomerByID(1);
if (customer != null)
{
// Print out order numbers
foreach (CustomersDataSet.OrderRow orderRow
in customer.GetOrdersRows())
{
Console.WriteLine(orderRow.OrderID);
}
}

When the relationship was created above, it added a GetOrdersRows() method on the CustomersRow object. It may not seem like much - but having the strongly typed OrderRow can help (well, it helped me).

After doing a quick search on GetOrdersRows() (to see if I had missed any examples of this) - I found a good ADO.NET tutorial. I wish I had have found that a few hours ago!



Comments (5) | Add Comment

Thursday, February 10, 2005

Dragging and dropping

# Posted by Joel Dixon at 10/02/2005 01:26:00

It took me ages, but I finally got drag-and-drop working in my shape drawing program. I had to code most of it myself (the Java dnd stuff wasn't that helpful), but it works just as I like it.

When you draw a few shapes (that intersect), you can use the object browser to drag them up and down the list (the shapes are drawn from bottom to top). So the shape at the top of the object browser will be drawn on top of all of the other shapes. (use different colours and thicknesses to really see the effect)

Small things amuse small minds - and my small mind was busy on that one for a while



Comments (0) | Add Comment

Saturday, January 29, 2005

A Good (?) Idea

# Posted by Joel Dixon at 29/01/2005 17:57:00
Updated by Joel Dixon at 19/08/2007 11:17:49


When trying to cut an image from paint I was squinting my eyes to see where my hairline cursor was sitting. I've used Hypersnap-DX to take screen captures for a while now - and it includes an integrated zoom window.

While doing my cut from paint, I was thinking that it'd be good to have the same kind of zoom window available with a keyboard shortcut. I know that Microsoft has their Magnifier (press Win-U), but it only provides a small window on the top of the current monitor. I'd like a way to zoom with my secondary monitor (I'm on a dual monitor setup) when I press a keyboard shortcut.

I was thinking that this might be something I have to make myself, until I remembered a product called UltraMon that provides these kinds of utilities. I had a quick look at their site and couldn't find it. Then I remembered the reason that I never bought UltraMon - my videocard came with software that provided all of UltraMon's functionality.

Sure enough - after a quick look through the nView Desktop software I found exactly what I was looking for. Now, when I press Ctrl-F12 the secondary monitor changes to a 10x Zoom window. The window also swaps monitors when my mouse does. See snapshop below (the right half is the zoomed window, and my mouse is somewhere in the top left of the first monitor. And yes, I'm currently listening to Live - I absolutely love "We Deal in Dreams").

I love finding things that I didn't know I had!

Zoomed screenshot



Comments (2) | Add Comment

Thursday, January 20, 2005

Draw some shapes - WOW!

# Posted by Joel Dixon at 20/01/2005 11:52:00

For the last 2 years I've been on the same project, providing support for an existing system. While I have made small / medium changes to the system, most of my time is spent dealing with problems to do with business logic.

As a result, I've decided to download JBuilder and stuff around with some math based programming.

I'm going to make a program that allows you to draw shapes (furniture) so that you can move them around and design a room. I've finished the drawing of shapes part - and thought I'd put it up here (I'll also post the source code when I get back home).

Click here for Shape Drawing Applet. It's very crappy at the moment, but it works and provides some basic options. When I tested that it was uploaded properly, I had already found one small bug - see if you can find it.

Let me know if there are any features / options that would make this program better (I'm already adding colour for the next version).



Comments (4) | Add Comment


Next Page
Blog Search

Advanced Search


Recent Blogs
Marc-André Fleury still giving high fives to his injured buddy
Mario Lemieux Fantasy Camp 2017 - Day 2 (Contract Signing, Training and Game)
Mario Lemieux Fantasy Camp 2017 - Day 1 (Registration and Penguins Stadium Series)
Pittsburgh Arrival - Border Security Magic, 2017
Pittsburgh Penguins - 2016 Stanley Cup Champions!
The Inca Trail, Peru - 2015
Lima & Cusco, Peru - 2015
Sakura & Bonus Wrap-up, Japan - 2015
Takayama & Gero, Japan - 2015
Nagoya, Japan - 2015

Feed
Subscribe to feed Blog Entries

Add to Google
Add to My Yahoo!

Recent Comments
Pittsburgh Arrival - Border Security Magic, 2017
posted 1 month ago by joeldixon
Welcome Mac - Love to see you here Mac! Speaking of the ice - shame that your big break ... link

Pittsburgh Arrival - Border Security Magic, 2017
posted 1 month ago by MacBeltKarate
Bad-ass Trip Bro - Woah dude! You played hockey with Mario Lemieux!? That bozo is up there as one of ... link

Living up to my title
posted 6 months ago by joeldixon
Yeah, I don't think it's working link

Living up to my title
posted 6 months ago by DonaldWhick
Test, just a test link

Living up to my title
posted 6 months ago by joeldixon
Was the test a success? link


Comment Standings
1. the man with no name (45)
2. Hoff (39)
3. Hitman (33)
4. Gav (27)
5. Brad (24)
6. Eryc-Ads (13)
7. milly (7)
8. Deep Lurker (6)
9. thefury (5)
10. Dieter (4)
About This Site | Contact Me | I have started Penguins training camp!