Blog

File-Logging in Delphi

I wanted to do some quick logging to help me understand some code flow in Delphi. But having the Starter Edition of Delphi was crimping my style! Starter Edition doesn’t include the Event Log Viewer to see the output from OutputDebugString() while running in the debugger.

So I kept coming back to “I really just need to get over the learning curve and set up a ‘proper’ logging tool like Log4J”, a tool I’d used for Java projects in times long past. StackOverflow suggested Log4D and Log4Delphi as good possible candidates.

After reviewing both packages, I decided to go with Log4D.

Log4D seemed a bit simpler in that everything you need for basic logging is in one .pas file and one .inc file. I can see advantages both ways as a developer, but for just get me some logging quick, only having to add two files rather than a handful, and only needing one new unit in the uses statement simplifies some things.

Neither one had been updated in the last few years, so when you’re talking about “make this compile in a current version of Delphi” it looked like similar level of work.

Log4Delphi claims to be “loosely based on” Log4J. Log4D claims to be a direct port of Log4J.

Log4Delphi appears to be fairly well documented, whereas Log4D has almost no documentation. And while usually I prefer to go with the well-documented version, I felt like the simplicity of one file would make it worth seeing if I could muddle through the lacking documentation to make Log4D work. A few Delphi experts on StackOverflow swear by Log4D.

There were two compile errors I had to fix to make Log4D compile on XE4:

The IFDEF around Contnrs is missed by newer versions of Delphi, so you need to add {$DEFINE DELPHI5_UP} to the end of the .inc file (or in the .pas file works too). And ShortDateFormat needed to change to FormatSettings.ShortDateFormat

That’s the bare minimum fix, a better fix that maintains backwards compatibility isn’t a whole lot harder See my StackOverflow Discussion here about fixing the IFDEF so “and above”. And the ShortDateFormat issue, just needs another IFDEF around the FormatSettings for XE+.

The only basic “how to get this up and running” example of Log4D I could find online was this one blog entry. It needed a couple changes to compile (“Trace” wasn’t one of the log levels in the downloaded Log4D package). And then a little more puzzling together from the code and documentation for Log4Delphi and Log4J to make a file logger. I’ll write more about those changes in my next post ;-).

Night at the Museum

Today we attempted to build “Night at the Museum”, Lego City set 60008 using our existing lego bricks. It’s a bit more…colorful…but the same basic shape.

Here’s how it came out:

 

More Minions

12319544184_d0c0a9b69d_320

Batman Minion by Elspeth De Montes

Her Superhero Minion Gallery includes the likenesses of Superman, Spiderman, The Incredible Hulk, and Wolverine. They are based on the Bricks Ben minion design, which is pretty complicated and uses a lot of studs not on top building techniques.

 

dsc02273

LegoTessa has a video of how to build her minions. These ones are a bit smaller and look quite doable without having to order a whole pile of bricks from pick-a-brick.

 

 

10041 Main Street

Today we are building the car shop from set 10041 Main Street (2003)

carstore

Continue reading 10041 Main Street

Double Decker Bus

This takes a LOT of windows…but it’s worth it, it was a pretty cool one to make…and no weird parts!

313

From set 313 “London Bus” from 1966 Continue reading Double Decker Bus

Taxicab

From set “LEGO City Train Station” 7937. You will need the entire instruction booklet 1 (of 2) for this model.

71TFYm48ljL._SL1500_

I picked this model to build, because it uses a bunch of “modern” car-parts we got from pick-a-brick and build-a-car.

4259673   4521778    4260124

But it did require one unusual part we didn’t have for the front bumper, which I blogged about yesterday.

So, here’s how it came out:

P1000608

I didn’t have any of those rounded roof pieces that is sloped up higher in the middle to accommodate minifig heads, so I had to add a row of flat bricks below the roof to give more clearance for heads.

 

 

Taxicab Alternate Grille & Bumper

Since I didn’t have one of these in my collection, I had to make an alternate bumper and grille.

4264898

Notice how the back of this piece has a slight curve so the wheels don’t hit it? That made my first prototype not work at all, and it took a couple tries to get a design that really worked. When I made this model, I tried different bumper styles in the front and back, but this one worked better.

car grill_1_0_0_0_1_0_0_0_1_5_2550_300_DPI_1

 

 

Parts List

grilleparts

Building Steps

car grill_page_1

download as printable pdf

 

Lego Armchair

Here’s a design I made up for a lego armchair:

chair_p1

Instructions (PDF)

 

chair.ldr (LDraw)

More Bunkbed Ideas

Last post about bunkbeds for a while, I promise ;-). I really love this proposal from Lego Cuusoo:

thumb640x360hhyhjy

Aside from being bright and colorful, there are some clever things they do here to make it look realistic, like using 1×1 headlight bricks for the ladder, and using bars/poles for the ladder rungs instead of a flat brick. And the desk lamp using two antennas? clever again.

minifig bunkbed

 

 

mybunkbed

Continue reading minifig bunkbed