Showing posts with label darwinraceoflanguages. Show all posts
Showing posts with label darwinraceoflanguages. Show all posts

Wednesday, July 23, 2008

Darwin Race of Langauges is Over!


Congratulations to all who finished! My downfall was I bit off more than I could chew by using a semi-familiar IDE and language, while attempting to learn COM and WMI. No excuses though! Even though I couldn't finish the race, I had fun and I learned more about RAD Studio in the process.

My one regret is that due to all the problems to solve being GUI based, I couldn't enter using my best language, GT.M. I bet that would be something no one else has seen =P.

In any case, that's just me rambling on (and trying to find some way to work GT.M into my post). Too bad none of the people who finished the competition entered anything for OSX.

Sunday, July 20, 2008

Whoops, I still have more time!

For some odd reason, I thought that the competition ended on the 18th. It turns out it actually ends on the 22nd, so I still have more time to work on it. The next block of free time that I have will be on the 21st, so we'll see if I can work some magic to figure out WMI and COM before the actual deadline.

Friday, July 18, 2008

Darwin Race of Languages - Day 4


So I've been defeated by COM and WMI. To me, what's missing in the Delphi world are comprehensive tutorials and documentation like you can find with MSDN and Sun (for Java). What I ended up trying to do was look at existing code that uses WMI in Delphi, and attempt to reverse engineer it. I have a reasonable understanding of the objects and techniques used in the sample code, but when I got stuck, I had no idea what was causing the problem. Unfortunately, the time ran out for the competition before I could make anymore headway. 

Earlier in the competition, I posted about my usual steps when learning something new, for the Darwin Race of Languages, I got stuck on step 2, developing the proof of concept, by reverse engineering existing examples.

If anyone is interested in looking at the code I was working on, the entire project is in a zip file here. Note that I'm not sure if all the imports will be correct on anyone elses pc, as the paths were local to my pc. I can't really call the code "my code", since it was mostly a cut and paste from someone named ciuly. I also used as reference, this project from Planet Source Code, which interestingly enough had errors, but ran on my workstation. When I attempted to extract the code and place it in my project, I ran into the same EOleException that I had in ciuly's example. That leads me to believe that the issue lies somewhere in my project, but not in the sourcecode. 

Darwin Race of Languages - Day 3 Part 2

Still no luck. All I can find are MSDN articles related to WMI on Microsoft's official languages, such as C++, C#, VB, etc. I can also find many examples of using WMI in Delphi, but there are no comprensive, newbie friendly tutorials on the different WMI components as related to Delphi and RAD Studio. I'm sure it's a simple fix to solve my problem, but those simple problems are the things that a newbie friendly tutorial will help walk me through.

When I was learning C#/.NET, I did most of my learning on MSDN. I've done multithreading, socket connections, registry modification, file encryption, used active directory, so on and so forth. I never once had to ask the wider .NET community for assistance, as MSDN has always been good to me. Ditto for learning Java, Sun's documentation is good as well (at least it was back when I was doing Java, the version 1 days).

uses
  Google, MSDN;

implementation
procedure Will_I_Win;
var
  Delphi: New_Language;
   RAD_Studio: New_IDE;
  WMI: New_Component;
   Success: string;
begin
   RAD_Studio := IDE.Create('CodeGear');
   Delphi  := RAD_Studio.Language;
   WMI := Component.Create('MS');
   success := 'You Fail';
   while OtherProjectsGoingOn do
   begin
     if Solveable(Delphi, RAD_Studio, WMI, "2 weeks") then
     begin
         success := 'yay!';
     end;
   end;
ShowMessage(success);
end;



Darwin Race of Languages - Day 3 Part 1

I've been reading through tons of examples of using WMI with Delphi, and I've tried running what seems like the most likely candidate for what I want to do (return the CPU temperature). However, I keep getting the error below.


It seems like I am unable to use Sinkclass.DefaultInterface when I call Services.ExecNotificationQueryAsync. Since the "Sink" is supposed to be an eventhandler that fires upon receipt of an event from Services, I guess this is a good error, since I don't have any code defined to handle the event, and I have absolutely no clue where DefaultInterface is in my Sink object. 

I'm not sure if I will be able to complete the project before the deadline, but I'll keep trying until the time runs out.

Saturday, July 12, 2008

My Delphi Race of Languages Day 2

Whew, MSDN is always a tough read! So far all I have are a "Hello World" app, and I examined a sample project that I found here. That author uses ActiveX to query WMI, I think I may go the ODBC route as I'm more familiar with T-SQL. Here's a few screenshots of todays small progress.

Here's a screenshot of RAD Studio running inside of Parallels on OSX.

Here's a screenshot of the sample project files.

Here's a screenshot of the imports I did so that I can use WMI with my app. Note that there is an activex import there, I'm probably going to remove that and use ODBC as noted earler.

Here's a screenshot of my simple little hello world.

[edit]I'm not so sure on using ODBC now. I don't know if it's a good idea to assume that an end user will have MDAC installed on their machine.[/edit]

Friday, July 11, 2008

My Delphi Race of Languages day 1

I've checked out the progress of some of the other competitors, seems like my late start has put me behind by a few days. That's alright though. My usual approach to a problem that I don't understand, is to do the following:
  1. Use my google-fu to do some research
  2. Get a proof of concept working
  3. Design the actual application
  4. Testing and refinement
So I'm at the google-fu stage. So far, it seems like the way to go in Delphi is to use WMI (Windows Management Interface), which is a part of the Win32 API, but I need to set up my project in RAD Studio to be able to use it properly.

I entered the Darwin Race of Languages


So my rantings on Delphi and RAD Studio sort of spawned a programming/IDE competition hosted here. I got an invite to compete, and I figure... why not? The worst that could happen is I become better at RAD Studio and Delphi, which is a good thing. I'm sure the critics that I have would love to tear apart my code, and I'm going to give them that chance!