KBD

Keith Devens .com

Sunday, October 12, 2008 Flag waving
Well, "actual" compliance means bug-free. That's hard to assure in a system of the size of a CL.... – Kent M. Pitman

Archive: March 09, 2003

← March 08, 2003March 10, 2003 →

Daily link icon Sunday, March 9, 2003

Copying, Cloning, and Marshalling in .NET

Via LtU, Copying, Cloning, and Marshalling in .NET.

I hate to admit it, but as a veteran C++ programmer and COM aficionado, I've spent an embarrassingly large part of the last decade thinking about how the objects in my code will be copied, duplicated, and marshalled from one place to the next. In other words, I spent a lot of time pushing bits around. These days, I'm spending more time with C# and the .NET environment, which offer a wide spectrum of language features and runtime services that make the art of programming vastly simpler, in almost every conceivable fashion -- but still, I find myself wondering about the precise semantics of all the various copying, cloning, and marshalling mechanisms at play in my code.

It has a great little diagram to explain shallow vs. deep copying Smiley

Firefly gag reel

Oh my gosh, a Firefly gag reel!!

God I miss that show :'(

Is it possible to load classes dynamically in PHP?

The subject says it all. Is it possible to load classes dynamically in PHP? In other words, can I say new $foo, where $foo is a string containing the name of a class? Hmm...

Ok, that answers that... it turns out it's possible to say "new $foo", but not "new "Foo"".

The following works and prints the constructor's message:

<?php
class Foo{
    function 
Foo(){
        echo 
"Foo constructor called!<br>";
    }
}

$foo "Foo";
$f = new $foo;
?>

But if the last line is $f = new "Foo", it doesn't.

Anyway, this is good enough for my purposes. I wanted to be able to load classes dynamically in my CMS, based on information in a configuration file. If I couldn't do this, I would have gotten around it by dynamically calling a function, which I was sure PHP could do.

Hey, and it's not even case sensitive Smiley I can say $f = new $foo; where $foo is "foo".

CMS-driven site, here we go?

Hey, I've finally gotten my CMS to the point where it can run my weblog Smiley Only downside is that comments don't work yet with it. But, at this point I think the only way to give me the incentive to get that working is to switch over to running my main site on it. So I'm going to do that Smiley

But shoot, I just realized that I didn't put the RSS generation into my CMS yet... well, here goes. Watch for breakage here over the next few hours Smiley winking

pinging weblogs.com again

Simon gave me the impetus to fix my code for pinging weblogs.com. So I've fixed it... let's see if this works.

Ok, worked. Now, for why it was broken... there were really two things happening at once that broke it. First, my site is a frankenstein running partially on my CMS and partially not. Some of my settings (I think maybe all now) are coming from the CMS (Settings, as in the name of my weblog and its URL). But through different revisions of my CMS, some settings came from MySQL, and some from the CMS's main configuration file. So stuff's all over the place. It turns out I had the name of my weblog in the config file, but not the address... so I added that.

After I did that, it turns out it was still broken, because while I'm working on version 3, my copy of my XML-RPC library is broken Smiley So I had to fix a piece of that before it would work.

Now that Simon mentions it, I may as well ping blo.gs too Smiley

Hey, the only thing that stinks about this is that weblogs.com is so overloaded that it just took 71 seconds to respond to my pings (to both the regular and the RSS versions). So I often have to wait around for it to finish.

Ok, testing pinging blo.gs... Yep! Worked.

← March 08, 2003March 10, 2003 →
October 2008
SunMonTueWedThuFriSat
 1234
567891011
12131415161718
19202122232425
262728293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 7 posts

Recent comments XML

I hate PHP

Elliot Anderson,

Dude!! You the​man! The reverse replacement for​array_u...

Alex Ndungu: Oct 11, 1:35am

Call a function from a string in Python

?!code:
some_object.__getattribute​__('method_name')()
?!/code

is​the s...

Patrick Corcoran: Oct 8, 3:53pm

Spider solitaire

I have won 185 games of Spider​Solitaire at the "Difficult" level.​ What is...

75.179.28.113: Oct 8, 12:42pm

Sed one-liners

Hi.

I wanted to let you know​that I wrote an article "Famous Sed​One-Lin...

Peteris Krumins: Oct 8, 3:05am

Timesheet Calculator

Hadn't seen it before now, but my​company already uses a time​tracking prog...

Keith: Oct 7, 10:44am

Girls, please don't get breast implants

Hey everyone, 

I am new to this​blog and I have enjoyed reading all​your...

Sarah.M.: Oct 6, 9:45am

Generated in about 0.05s.

(Used 7 db queries)

mobile phone