tag:blogger.com,1999:blog-279479072024-02-20T23:34:50.849+02:00LA's BlogLessons, knowledge snippets and personal growth, all fine tuned by God's hands and redeemed through Christ's work on the cross for all to see and share.Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.comBlogger101125tag:blogger.com,1999:blog-27947907.post-44847965151255266482012-06-22T12:35:00.001+02:002012-06-22T12:53:49.819+02:00How will another unit test framework cause me to write better tests than using MSTest ? I started out with an idea of writing down some of the things I discovered while writing unit tests on both MSTest and the popular NUnit unit testing frameworks and for the most part I wasn't impressed with MSTest. The article developed on how MSTest sucks (the one fore Visual Studio 2010) and how NUnit rules (ok its a bit biased and exaggerating but get this...) but I got hit with one fundamental question...<br />
<br />
<div style="color: #cc0000;">
<span style="font-size: small;"><b>How will another unit test framework cause me to write better tests than using MSTest?</b></span></div>
<br />
You see you can have all the "nice features" in the world but if you still write unit tests against a system that isn't well designed or broken up in testable pieces, you will have a hard time writing maintainable unit tests. The other thing is that even if you have the most wonderful designed system and unit-test friendly classes to test against, you still sit with the problem of writing maintainable unit tests.<br />
So I thought of rewriting the post and taking on this discussion from a different perspective. Instead of blabbering on about how this framework rocks and the other one doesn't let's ask the question above. Why against MSTest? Because it seems to be the underdog at the moment. Look at what some of the other bloggers have to say:<br />
<ul>
<li><a href="http://blogs.dotnetkicks.com/dnk-jump-in/2011/09/20/why-would-anyone-use-mstest-over-nunit-jump-in/" target="_blank">Why would anyone use MSTest over NUnit?</a> (See the main article and especially the long comment by Thommas Weller).</li>
<li><a href="http://blog.ploeh.dk/2010/04/26/WhyImMigratingFromMSTestToXUnitnet.aspx" target="_blank">Why I'm migrating from MSTest to XUnit.net?</a></li>
<li><a href="http://osherove.com/blog/2011/8/24/why-mstest-is-the-ie6-of-unit-test-frameworks.html">Why MSTest is the IE6 of unit test frameworks</a></li>
</ul>
<a href="http://osherove.com/blog/2011/8/24/why-mstest-is-the-ie6-of-unit-test-frameworks.html"></a>I also have a couple of things to say about it which I just quickly want to add before I ask the big quesiton.<br />
<ul>
<li>Firstly it seems to be another monolithic solution from Microsoft. Why not have a .NET testing solution which can be broken down in different testing modules so that you can use the best tool for the job? So then you can use the other testing tools from Microsoft but for Developer unit testing you use something like NUnit or something. But I know why this is the case because again Microsoft wants you to use their products. Now it wouldn't have been a problem if they have taken certain things into account like some of the bloggers up there have stated like extensibility, etc.</li>
<li>Startup time is SLOW! And then it's only basic logic tests!</li>
<li>There are plugins in Visual Studio to run NUnit tests that are free! (Not a MSTest gripe but many people stick to MSTest because its integrated. Speaking of which there are ways apparently, which I haven't tested myself, to run NUnit on a TFS build server. Check this link: "<a href="http://nunit4teambuild.codeplex.com/" target="_blank">NUnit for Team Build</a>").</li>
</ul>
So now I want to start this question objectively and look at how using the best features of unit tests allow me to write more maintainable unit tests. But in instead of taking every unit testing framework I will settle with NUnit and MSTest because I am familiar with NUnit and it seems to be the most popular one out there, and MSTest because everyone is slashing this one to bits so it should provide a nice view if they really make a difference.<br />
Now you might say "I've done this and that with MSTest and it took me hours while I could have done the same in NUnit in minutes". Let's find out shall we?<br />
<br />
I'm not going into UI tests and Web tests. Firstly I don't think something like NUnit should be brought anywhere near UI testing! MSTest might have a nice UI tester but you might need to purchase Visual Studio Ultimate or something to get hold of it. Neither am I going to do web tests which involve HTML and JavaScript! That's just a maintenance nightmare waiting to happen!<br />
No I will solely stick to logic tests and maybe even integration tests. Let Developer unit testing BE developer unit testing, anything else, use some of the other tools that are more suited for the job!<br />
<br />
Writing tests for small methods are fine because your tests are inherently small to test the small amount of work it needs to do. Stuff like math functions, you give it an input and it spits out an output, very simple and quick. You do the MATH! LOL!<br />
Some of you may say "Well NUnit will simplify your life there, you can have 1 test method with a few value attributes". That's true so NUnit can give you some simplified and good test coverage there. MSTest will require the code duplicate approach or you have to write the plumbing (again it might not be what developers would like as MSTest is not as extensible as NUnit) to get to the same kind of ease-of-effort that NUnit guys are enjoying. <br />
<br />
But let's make it more interresting!<br />
<br />
How about writing tests against a WCF service where you need to stub out some calls to other services and have to validate that the correct logic is being followed?<br />
<br />
So let's say I have a WCF service class:<br />
<br />
<span style="font-size: x-small;"><i>public class TimeSheetService : ITimeSheetServiceContract</i></span><br />
<span style="font-size: x-small;"><i>{</i></span><br />
<span style="font-size: x-small;"><i> public PersonDetails GetPersonDetails(string id)</i></span><br />
<span style="font-size: x-small;"><i> {</i></span><br />
<span style="font-size: x-small;"><i> ... some code here ... </i></span><br />
<span style="font-size: x-small;"><i> }</i></span><br />
<span style="font-size: x-small;"><i>}</i></span><br />
<br />
Ok seems easy to test:<br />
<br />
<b><u>NUnit</u></b><br />
<br />
<span style="font-size: x-small;"><i>[Test]</i></span><br />
<span style="font-size: x-small;"><i>public void Get_user_details_from_timesheetservice_that_is_existing()</i></span><br />
<span style="font-size: x-small;"><i>{</i></span><br />
<span style="font-size: x-small;"><i> TimeSheetService service = new TimeSheetService();</i></span><br />
<span style="font-size: x-small;"><i> var person = service.GetPersonDetails("12345");</i></span><br />
<span style="font-size: x-small;"><i> Assert.That(person, Is.Not.Null);</i></span><br />
<span style="font-size: x-small;"><i> Assert.That(person.Name, Is.EqualTo("James")); </i></span><br />
<span style="font-size: x-small;"><i>}</i></span><br />
<br />
<b><u>MSTest</u></b><br />
<br />
<span style="font-size: x-small;"><i>[TestMethod]</i></span><br />
<span style="font-size: x-small;"><i>public void Get_user_details_from_timesheetservice_that_is_existing()</i></span><br />
<span style="font-size: x-small;"><i>{</i></span><br />
<span style="font-size: x-small;"><i> TimeSheetService service = new TimeSheetService();</i></span><br />
<span style="font-size: x-small;"><i> var person = service.GetPersonDetails("12345");</i></span><br />
<span style="font-size: x-small;"><i> Assert.IsNotNull(person);</i></span><br />
<span style="font-size: x-small;"><i> Assert.AreEqual("James", person.Name); </i></span><br />
<span style="font-size: x-small;"><i>} </i></span><br />
<br />
Not much of a difference, right? But hang on a moment! Where do I stub the person with the name "James"?<br />
Big deal, I'll just use my favorite mocking framework to do that.<br />
I currently use Rhino Mocks as my mocking framework and I am open for discussion, so if you see me doing something wrong or you want to notify me on something else that Rhino Mocks users will like to move across to please let me know. Assume I have a preconfigured 'mock' object (will get to that later) and I have <u>noticed</u> that the service needs an IPersonRepository object.<br />
<br />
<u><b>NUnit</b></u><br />
<br />
<span style="font-size: x-small;"><i>[Test]</i></span><br />
<span style="font-size: x-small;"><i>public void Get_user_details_from_timesheetservice_that_is_existing()</i></span><br />
<span style="font-size: x-small;"><i>{</i></span><br />
<span style="font-size: x-small;"><i> IPersonRepository personRepository = mock.StrictMock<IPersonRepository>();</i></span><br />
<span style="font-size: x-small;"><i> personRepository.Expect(x => x.GetPersonDetailsFromRepository("12345")).Return("James");</i></span><br />
<span style="font-size: x-small;"><i> mock.ReplayAll();</i></span><br />
<br />
<span style="font-size: x-small;"><i> TimeSheetService service = new TimeSheetService(personRepository);</i></span><br />
<span style="font-size: x-small;"><i> var person = service.GetPersonDetails("12345");</i></span><br />
<span style="font-size: x-small;"><i> Assert.That(person, Is.Not.Null);</i></span><br />
<span style="font-size: x-small;"><i> Assert.That(person.Name, Is.EqualTo("James")); <br />
</i></span><br />
<span style="font-size: x-small;"><i>}</i></span><br />
<br />
<b><u>MSTest</u></b><br />
<br />
<br />
<span style="font-size: x-small;"><i>[TestMethod]</i></span><br />
<span style="font-size: x-small;"><i>public void Get_user_details_from_timesheetservice_that_is_existing()</i></span><br />
<span style="font-size: x-small;"><i>{</i></span><br />
<span style="font-size: x-small;"><i> </i></span><span style="font-size: x-small;"><i>IPersonRepository personRepository = mock.StrictMock<IPersonRepository>();</i></span>
<br />
<span style="font-size: x-small;"><i> personRepository.Expect(x => x.GetPersonDetailsFromRepository("12345")).Return("James");</i></span><br />
<span style="font-size: x-small;"><i> mock.ReplayAll();</i></span><br />
<br />
<span style="font-size: x-small;"><i> TimeSheetService service = new TimeSheetService(</i></span><span style="font-size: x-small;"><i>personRepository</i></span><span style="font-size: x-small;"><i>);</i></span><br />
<span style="font-size: x-small;"><i> var person = service.GetPersonDetails("12345");</i></span><br />
<span style="font-size: x-small;"><i> Assert.IsNotNull(person);</i></span><br />
<span style="font-size: x-small;"><i> Assert.AreEqual("James", person.Name); </i></span><br />
<span style="font-size: x-small;"><i>} </i></span><br />
<br />
See how much it grew? Both are still the same length. The problem is that this is how we generally run into these things. If we don't take care, we usually end up with bloated unit test methods!<br />
Now's the question is how can the unit testing framework make my life simpler?<br />
Now let's forget using other libraries (AutoFixture as example) and let's forget writing helper methods (unless it's part of getting the framework to help deal with this). Let's get the unit testing framework to do most of the work for us. See what I mean with this? I know that there are stuff out there that can help deal with this but that's not the point. Can my unit testing framework help take care of this without me having to write helper methods/classes or rely on external solutions? If it cannot, then why? Those are the things I want to point out.<br />
<br />
<b>And so I present this as a question to you the reader. </b>I know MSTest and I know NUnit but I don't know all the integral details that each offer to leverage it to my advantage. So if you look at the above and see some area where MSTest or NUnit can make my life easier please comment below. If you are experienced in another unit testing framework, please give your input as well! You don't necessarily have to give big code replies, just mentioning a feature and how it can be applied should help get a picture.<br />
<br />
Just to finalize this let me give a broader picture of the problem and then hopefully people can start sharing their input so that we can really see how much of a difference a unit testing framework makes.<br />
<br />
First there is the Rhino Mocks problem. How can I create a new MockRepository for each test and provide it in such a way that when I call the field (or property) "mock" that I have a ready to be used mock. Also don't forget that Rhino Mocks expect the "ReplayAll" to be called before you call your SUT (System Under Test) code and after the test is completed it need to "VerifyAll" against the mock repository object.<br />
<br />
Secondly I want to test something else. I want to test the SubmitTime method.<br />
Let me write out the code (only the relevant stuff) so that you can have a clearer picture of what needs to be tested:<br />
<br />
<span style="font-size: x-small;"><i>public class TimeSheetService : ITimeSheetServiceContract</i></span><br />
<span style="font-size: x-small;"><i>{</i></span><br />
<span style="font-size: x-small;"><i> private readonly IPersonRepository _person;</i></span><br />
<span style="font-size: x-small;"><i> private readonly ITimeCaptureRepository _timeCapture;</i></span> <br />
<br />
<span style="font-size: x-small;"><i> public TimeSheetService(IPersonRepository person, ITimeCaptureRepository timeCapture)</i></span><br />
<span style="font-size: x-small;"><i> {</i></span><br />
<span style="font-size: x-small;"><i> _person = person;</i></span><br />
<span style="font-size: x-small;"><i> _timeCapture = timeCapture; </i></span><br />
<span style="font-size: x-small;"><i> }</i></span><br />
<br />
<span style="font-size: x-small;"><i> public PersonDetails GetPersonDetails(string id)</i></span><br />
<span style="font-size: x-small;"><i> {</i></span><br />
<span style="font-size: x-small;"><i> var result = _person.GetPersonDetailsFromRepository(id);</i></span><br />
<span style="font-size: x-small;"><i> return new PersonDetails { Name = result.Name, Categories = result.Categories };</i></span><br />
<span style="font-size: x-small;"><i> }</i></span><br />
<br />
<span style="font-size: x-small;"><i> public bool SubmitTime(TimeSubmitRequest request)</i></span><br />
<span style="font-size: x-small;"><i> {</i></span><br />
<span style="font-size: x-small;"><i> PersonDetails personDetails = GetPersonDetails(request.PersonId);</i></span><br />
<span style="font-size: x-small;"><i> bool added = _timeCapture.SubmitTimeCapture(request.PersonId, personDetails.Categories, request.TimeSlots);</i></span><br />
<span style="font-size: x-small;"><i> return added;</i></span><span style="font-size: x-small;"><i><br /></i></span><br />
<span style="font-size: x-small;"><i> } </i></span><br />
<span style="font-size: x-small;"><i>} </i></span><br />
<br />
Now the Id or PersonId is a string, Categories are IList<string> and TimeSlots are IList<TimeSlot> and TimeSlot is of class of properties { DateTime StartTime, int Minutes, string Category }<br />
<br />
If there are somethings that are not clear let me know.<br />
<ul></ul>
<ul>
</ul>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-48344683171237101642011-11-09T20:05:00.001+02:002011-11-10T07:42:48.901+02:00Renewal Project's WCF Extensions LibraryHi all<br />
<br />
Just wanted to announce that I've released a beta-version of my WCF Extensions Library on my CodePlex project called Renewal Projects. Check out the documentation section for more info. I think WCF users in the .NET space may want to have a look at this as it might prove useful in the long run as it contains a Channel Repository, Channel Pool and the possibility to have WCF channels hosted in a IOC container.<br />
Its in BETA at the moment but testers are welcome to try it out.<br />
<br />
<a href="http://renewalprojects.codeplex.com/" target="_blank">http://renewalprojects.codeplex.com/</a>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-85099716672112411232011-11-02T21:45:00.002+02:002011-11-09T20:07:09.221+02:00MVC 2 Hidden Helper ExtensionI don't know if you've ever needed to store an entire entity object inside a html page using the hidden form fields but for some reason the standard ASP.NET MVC HiddenFor() method doesn't do that. It only seems to work for simple data types such as ints and strings, etc.<br />
So I wrote a little helper method to do just that.<br />
It takes all the entity that you wish to store in your HTML page and iterates over each property and performs a Hidden() method call on them to ensure that all its properties are encoded as hidden fields so that it gets passed back to the Controller Action via the POST method.<br />
<br />
<code>
public static MvcHtmlString HiddenEntirelyFor<TModel, TResult> (this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression)<br />
{<br />
ModelMetadata modelMetadata =<br />
ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData);<br />
List<string> htmlEntries =<br />
modelMetadata.Properties<br />
.Select(property => htmlHelper.Hidden(ExpressionHelper.GetExpressionText(expression) + "." + property.PropertyName, property.Model, null))<br />
.Select(mvcHtmlString => mvcHtmlString.ToHtmlString())<br />
.ToList();<br />
return MvcHtmlString.Create(String.Join(Environment.NewLine, htmlEntries.ToArray()));<br />
}
</code>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-26978249690972577892011-09-05T09:05:00.000+02:002011-09-05T09:05:05.759+02:00Moles with Mocking capabilityMyself and a colleague of mine made a discovery when we started to do some unit test coding with moles that it doesn't have any expectation-functionality like Rhino mocks where you can specify what the incoming parameter values should be for a mocked-class.<br />
<br />
That's when I did some searching on the web for mocking frameworks which might complement the Moles tool-set. I came across this library: <a href="http://simpledotnet.codeplex.com/">http://simpledotnet.codeplex.com</a><br />
<br />
It's not the best out there but it does feature one thing that other mocking frameworks (and correct me if I'm wrong) doesn't have and that is delegate mocking. I told my colleague about it and he tried it out... and it worked! It makes coding less and improves readability.<br />
<br />
Now suppose you have a class ClassX that you want to mock.<br />
Now with Moles you can only stub the target type by substituting the behavior with delegates.<br />
With Simple.Net, you first create the expectation scope:<br />
<br />
<code>var expectationScope = new ExpectationScope();</code>
<br />
<br />
Then you can create the mock-delegate:<br />
<br />
<code>
var getNameMock = Mock.Delegate<MolesDelegates.Func<ClassX, string>>();
</code>
<br />
<br />
Now we stub the target class with the mock:<br />
<br />
<code>
MClassX.AllInstances.GetName = getNameMock;
</code>
<br />
<br />
Now you set some expectations:<br />
<br />
<code>
Expect.Exaclty(1).MethodCall(() => getNameMock(Any<ClassX>.Value)).Returns("Fred");
</code>
<br />
<br />
Run your system under test code:<br />
<br />
<code>
ClassX x = new ClassX();<br />Assert.AreEqual("Fred",x.GetName());
</code>
<br />
<br />
Verify expectations are met:<br />
<br />
<code>
AssertExpectations.IsMetFor(expectationScope); </code><br />
<br />
And now your test should succeed. Please check out the Simple.NET website to see how this mocking framework works.<br />
<br />
Hope this helped someone.Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com1tag:blogger.com,1999:blog-27947907.post-89841052953385744692011-09-02T19:44:00.001+02:002011-11-02T22:04:03.668+02:00Renewal Projects first releaseHi there all.<br />
I have been working on my own open-source project for a while now. Its actually going to be a collection of projects but I think you get the idea. I have released my first .NET assemblies on CodePlex (<a href="http://renewalprojects.codeplex.com/">http://renewalprojects.codeplex.com</a>):<br />
<ul>
<li>.NET Encrypted Configuration Viewer</li>
<li>ParamGate application parameter handling library</li>
</ul>
Its the first of many to come (I hope). I am working on it on my own time. Let me know what you think.Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-28367231086390680982011-08-17T19:27:00.000+02:002011-08-17T19:27:21.087+02:00Moles, WCF and IDisposableWe all have heard of the Moles tool which Microsoft released some time ago which allows one to stub any Type with a custom one (which substitutes the behavior of the original one) for the purpose of writing unit tests a bit easier. I did wonder some time ago if one could use this to stub WCF proxies so that you don't have to create a stubbed service hosts and make changes in your App.config, etc.<br />
Initially it seemed like a dud but when I left it for a while and came back to it later I discovered that the solution is simple but not so obvious. I am not going to cover the basics of Moles, you can google that for yourself, I'm going to cover the necessary steps to get your WCF proxies (or whatever similar case) stubbed for unit testing purposes.<br />
<br />
The problem that I had with Moles and WCF was that the proxy classes inherited from ClientBase (which wasn't the problem) which in turn inherited from IDisposable. Now since a proxy's constructor tries to check the configuration file for proxy configuration, I had to sub the constructor of that proxy with an empty delegate. I managed to stub the proxy call with something that returned a dummy value and running through the tests, it actually stubbed that proxy call which is what I wanted.<br />
This was fine but I had a couple of proxies wrapped around a 'using' statement and at the end of a using statement the proxy's Dispose() method gets called and I got greeted with a nice NullReferenceException. I realised it was because I stubbed the constructor but when I checked for the Dispose method to stub, I couldn't find it anywhere in the generated Moled-Proxy class. That's the part that messed me around.<br />
<br />
After some thinking and some Googling I started to think that I might have to "mole" the System.ServiceModel assembly in order to stub the Disposable method found in the ClientBase<> class. This also had a minor problem. It caused a compiler error but after some Googling someone recommended that I amend the 'System.ServiceModel.moles' file with the following:<br />
Beneath the <Assembly> tag just add the following:<br />
<code><br />
<StubGeneration> <br />
<Types> <br />
<Clear/> <br />
<Add Namespace="System.ServiceModel.Description!"/> <br />
</Types> <br />
</StubGeneration> <br />
</code><br />
<br />
When you compile the unit test project it should finally generate the moled System.ServiceModel assembly and now we can finally stub that method! Now suppose you had a proxy which had the contract of IGeneral, you would stub its Disposable method like so:<br />
<code><br />
MClientBase<IGeneral>.AllInstances.SystemIDisposableDispose = (c) => { };<br />
</code><br />
<br />
Unfortunately you cannot just specify the MClientBase<> without specifying a Type. It will give a compiler error.<br />
<br />
So by using an example unit test:<br />
<code><br />
[TestMethod]<br />
[HostType("Moles")]<br />
public void TestMethod1()<br />
{<br />
MGeneralProxy.AllInstances.GetName = (p) => "Stubbed Name";<br />
MGeneralProxy.Constructor = (p) => { };<br />
MClientBase<IGeneral>.AllInstances.SystemIDisposableDispose = (c) => { };<br />
<br />
using (GeneralProxy p = new GeneralProxy())<br />
{<br />
Assert.AreEqual("Stubbed Name", p.GetName());<br />
}<br />
} <br />
</code><br />
<br />
You should be able to successfully run it and stubbing the proxy call for your unit test to work.<br />
the 'using' block should actually be the part where the production code gets executed but for demonstration purposes, I left it as is so that you can get the idea that the proxy gets stubbed as it should.<br />
Here is the rest of the code for some clarity:<br />
<code><br />
public interface IGeneral<br />
{<br />
string GetName();<br />
}<br />
<br />
public class GeneralService : IGeneral<br />
{<br />
public string GetName()<br />
{<br />
return "General Name";<br />
}<br />
}<br />
<br />
public class GeneralProxy : ClientBase<IGeneral>, IGeneral<br />
{<br />
public string GetName()<br />
{<br />
return Channel.GetName();<br />
}<br />
} <br />
</code>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com1tag:blogger.com,1999:blog-27947907.post-43915870543794793062011-08-17T19:14:00.000+02:002011-08-17T19:14:40.459+02:00My Half-Life 2 Episode 3 speculationsI have been watching the web for a while for the anticipated sequel to Half-Life 2 (Episode 3) which has been in the works for quite some time now. Being a Half-Life fan myself, I too can't wait for its release, however many people have been speculating what the story may contain and how it will play out.<br />
If you haven't played Half-Life 2's episodes and you would like to in the near future, then I do would like to give note that there <b>might </b>be some spoilers in this post. Looking through the web and listening to the developer commentaries, I thought it would actually be pointless to try and speculate what Valve is going to do next because they actually just plan and improvise as they go (which is probably why they take so long on each of their games) but I thought to just throw the stone and see where it hits.<br />
<br />
Some people think that the helicopter ride from White-forest is going to be a cut scene followed by the "unforeseen consequences" that's going to happen when Gordon finally uncovers the secret of what the Borealis might hold and then we find out what happens from there on in the rest of the game.<br />
Now personally, judging on how Valve developed the HL games in the past, I would like to state a different point of view. HL doesn't have cut scenes, you play from the morning you arrived at Black Mesa to the point where you defend the White-forest base, though there is a time lapse of approx. 10 years between HL and HL2 and not to mention the week-slow teleport.<br />
<br />
I would like to present some of the stuff that's already out there, in terms of clues, previous occurrences in HL, interviews, etc. It helps to paint the picture of what to expect.<br />
<br />
I think the helicopter ride (from White-forest) is going to be far from pleasant and quick. They would maybe make a few pit stops along the way, because the arctic is a far way off. They might need to refuel or they might even crash the chopper along the way.<br />
Also there is the head-crab that jumped into the satellite at the end of episode 2 and judging of what happened with Gordon in the beginning of HL 2, you can just imagine what might happen after the launch. Yes the portal between the Combine and earth is closed, but what else might happen? I think that at some point Alex and Gordon is going to be separated again and Gordon is going to be faced with a difficult decision to make (which the story is going to do for you anyway but it gives you the illusion of the choice). <br />
<br />
Would Adrian Shepherd make a comeback or is he totally lost forever? The reason I ask is because at the end of Oposing Force, the case file states:<br />
<i>Status: Detained</i><br />
<i>Further evaluation pending.</i><br />
There is also a <a href="http://www.youtube.com/watch?v=T5u0rAKTLH0&feature=related">YouTube</a> video depciting the keyboard found on the background of Portal 1 (once you've finished the game) has all the necessary keys highlighted which (when put together) forms "Adrian Shepherd". Could that be an indication of something? Also, Barney never spoke in BlueShift but they gave him a voice in HL2. Couldn't the same happen with Adrian. Also, if he were to make a comeback what role would he play? <br />
<br />
I also stumbled on some half-life wiki which features some of the <a href="http://half-life.wikia.com/wiki/Half-Life_2_original_storyline">earlier Half-Life 2 concept story and art</a> which actually has the Borealis boat and base depicted. Just something interesting I thought I wanted to share. The original story has been DRAMATICALLY changed but maybe it might give us some idea of what to expect.<br />
<br />
In a relatively old post at <a href="http://www.computerandvideogames.com/article.php?id=240672?cid=OTC-RSS&amp;attr=CVG-News-RSS">Computer And VideoGames</a>, they featured Gabe Newell who explained: <i>"I feel like we've gotten away from genuinely scaring the player more than I'd like, and it's something we need to think about, in addition to broadening the emotional palette we can draw on."</i><br />
The article ended with: <i>When Edge asked what scares them the most, he had a particularly dark answer: "The death of their children. The fading of their own abilities."</i><br />
Could this mean that someone close to Gordon is going to die? We also know that the Advisors are powerful, being able to pull Gordon and plunge him to the nearest wall and he is pretty worthless against them. Would they be able to weaken Gordon to some extent? Could Gordon be teleported to the Combine world somehow? I think that could also be scary. Maybe that's where Adrian would come to help Gordon providing he makes a comeback.<br />
<br />
With the death of Eli, the resistance might suffer a bit since Eli was the leader of the human resistance. Would the resistance loose its power? When I listened to the commentary of Episode 2's ending, the game creators mentioned that Eli has reached his purpose in the game. So what other side effects could we expect from his death other than Alex's wanting for revenge? Alex might put herself in unnecessary danger due to her thirst for revenge and that might cause the unnecessary separation between Gordon and Alex.<br />
<br />
Lastly, what new revelations would we see of the G-Man? We have learned that he is not the main chief but is actually "working" for some "employers" who somehow orchestrate the whole chain of events but to a certain extent. He mentioned "the biggest embarrassment has been Black Mesa" which implies that they are not in so much control as they make out to be, also we see in the beginning of Episode 1 how the Vaurtigans holds the G-Man back. Yet the G-Man keeps on "predicting" the future. He spoke to Eli twice saying "Prepare for unforeseen consequences", before the Black Mesa incident and at the end of Episode 2. Is it future vision or just the logical statement to make based on his orchestration of events that leads to the catastrophic happenings? There is still too much unknown about this character to make any good speculation. For all we know he could be a supernatural being or even an alien. Only Valve knows at this point? Or do they? ;-) <br />
<br />
<br />
Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-27849175340979633012011-07-21T20:03:00.000+02:002011-07-21T20:03:21.179+02:00{Insert teacher name here}"Oh by the way, did you hear about Rob Bell's controversial book?", I heard someone say to me a couple of weeks back. At first I wasn't sure what it was about, and I didn't think that it would have sparked the flame within the Christian community because I've been a listener to Rob's DVDs for a couple of years and he seemed ok to me.<br />
<br />
After finally going on YouTube to look for some interviews over his new book "Love wins", I was shocked over the way Rob responded to the interviewers and each time he would either give a rehearsed response to the problem in Japan or he would back-pedal over certain issues such as with the questions over God's wrath answering something a little different than written in the book or when asked about whether the crucifixion is the chief and main relevance to Christianity, he would side-step the question.<br />
<br />
I would agree that this is a hard thing for me to take in. Like I said, I knew Rob from his Nooma series and it was very thought provoking and helpful, especially within small groups, etc. I read his book "Sex God" and watched his hour lecture on "Everything is spiritual" and based on what I heard, everything seemed clear and fine (based on what I understood ofcourse). To even think that Rob is a heretic was unthinkable. I thought it was just a misunderstanding of some sort (and in a way I think it can be) but I think the gap is too big to look past it.<br />
<br />
The more I listened to his interviews the more he sounds different. It's as if he cannot find his own feet with those questions. Now, just to make something very clear,<b> I haven't read his book</b>.<br />
I admit and I will try not to comment on his book but rather on the media around his book and the interviews that are freely available on the web.<br />
<br />
Now I may sound like another blog writer giving my two cents worth on the web about a man who seems to have "lost his way" but what I want to get out of this post is not to discredit, tear down or bad mouth him, but rather create the awareness of how easy it can be for any preacher to preach a message that is just alongside the truth. No matter who the person is, no matter how wonderful his/her message seems like, we need to validate their message. Also, just because they've helped a lot of people and stand for worthy causes, doesn't make their wrong preaching right. I know that not everyone is perfect, I mean we might get something wrong during a preaching/teaching and we need to take the responsibility of admitting that we've been wrong when we discover that it is true and to correct it but I'm not talking about slight misunderstandings in scripture I'm talking about something that's a fundamental belief that could alter the way we live as Christians in our lives.<br />
Take for instance the idea of the crucifixion. If I believe that Jesus died on the cross but didn't rise from death, then I won't be able to believe that my sins are forgiven and I would be having a lot of other false beliefs entering my idea of Jesus. That's what I'm talking about.<br />
<br />
I can go on and on about Rob's statements but that's not the point of this article, I could have written about someone else entirely who also is close to my heart. For all I know Chip Ingram can also loose his way (and I sincerely hope he doesn't and that God protects him). The point is, this is how crafty the devil is and how vulnerable we are. Any one of us can fall victim to these shifts into wrong fundamental beliefs. Its just that the case with Rob (whether he is guilty or not of heresy) has opened my eyes to the reality that even the best or wonderful of teachers (except Jesus ofcourse) can fall victim to these headlines which we see in the case with Rob. I'm not saying that everyone of them will be victim of it, its just that its a warning to us all to be on the lookout in case it does happen.<br />
<br />
So what I would propose is that we pray for people like Rob Bell, also our very own pastors and preachers that they wouldn't fall victim of Satan's attacks and that they (and we) would gain discernment from the Holy Spirit to interpret the scriptures correctly.<br />
<br />
God Bless.Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-90636763498692577062011-06-22T09:38:00.000+02:002011-06-22T09:38:39.018+02:00Configuring Proxy settings in .NET config fileHi all<br />
<br />
Usually at work when I wanted to test something that requires to make a call over the web, I had to code two lines into my C# app to allow my application to work over our proxy:<br />
<br />
<code><br />
WebRequest.DefaultWebProxy = WebRequest.GetSystemWebProxy();<br />
WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultCredentials;<br />
</code><br />
<br />
Now, I found that you can actually configure your App.config or Web.config to do this for you.<br />
<br />
<code><br />
<configuration><br />
<system.net><br />
<defaultProxy enabled="true" useDefaultCredentials="true"><br />
</defaultProxy</code><code>><br />
</system.net><br />
</configuration></code><br />
<br />
This would set the proxy to be used to the one currently configured in Internet Explorer and uses your currently logged in credentials to access the web through the proxy.<br />
<br />
If you need to specify a different proxy, you could specify it like this:<br />
<br />
<code><br />
<defaultProxy enabled="true"></code><br />
<code> <proxy proxyaddress="some new proxy" /> </code><br />
<code></defaultProxy><br />
</code><br />
<br />
There is just one issue with this, you cannot specify credentials explicitly to use in the configuration file that needs to be used for proxy access. If you have to make use of a proxy and the account you use to log into windows doesn't have access to that proxy, you would have to specify a different set of credentials to be used.<br />
Yes you can code this in C# by specifying Credentials in your Default proxy.<br />
But this is not always desirable.<br />
I did find a <a href="http://stackoverflow.com/questions/186800/is-it-possible-to-specify-proxy-credentials-in-your-web-config">post</a> on Stack Overflow where someone suggested that you create a Proxy class and inject it as a Module, which is what I'm going to demonstrate here:<br />
<br />
<code>public class MyProxy : IWebProxy<br />
{<br />
public Uri GetProxy(Uri destination)<br />
{<br />
string proxy = ConfigurationManager.AppSettings ["proxyaddress"];<br />
return new Uri(proxy);<br />
}<br />
<br />
public bool IsBypassed(Uri host)<br />
{<br />
return false;<br />
}<br />
<br />
public ICredentials Credentials<br />
{<br />
get<br />
{<br />
string username = ConfigurationManager.AppSettings ["username"];<br />
string password = ConfigurationManager.AppSettings ["password"];<br />
return new NetworkCredential(username, password);<br />
}<br />
set { }<br />
}<br />
}</code><br />
<br />
And in the config file:<br />
<br />
<code><br />
<configuration><br />
<appSettings><br />
<add key="proxyaddress" value="http://proxyaddress"/><br />
<add key="username" value="my user"/><br />
<add key="password" value="my password"/><br />
</appSettings><br />
<system.net><br />
<defaultProxy enabled="true" useDefaultCredentials="false"><br />
<module type="MyAssembly.MyProxy, </code><code>MyAssembly</code><code>"/><br />
</defaultProxy><br />
</system.net><br />
</configuration> </code><br />
<br />
This would make use of the proxy we coded to specify which proxy to use and with which credentials. You might want to cache those settings, etc. but this is just a simple example of how to do this. This way you don't have to touch your production code at all and still configure it to be proxy-aware.<br />
<br />
I hope this would be useful to some one as it has been for me.Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-71544364344347515612010-06-27T22:08:00.000+02:002010-06-27T22:08:44.412+02:00TFS BuildsSome interesting things to note when doing TFS Builds. (I've written this article a few months ago before Visual Studio 2010, just to bear in mind)<br />
<span id="fullpost"><br />
Being exposed to the .NET world for too long, I actually became acquainted with Team Foundation Server for Version Control, Continuous Integration Builds and Release Builds. I'm not going to comment on the system at the moment. I just want to write something that is for me for future reference and maybe that can help someone else.<br />
<br />
I've been struggling a bit on configuring the TFS Build server to not output all the project files to a single Binary folder but to keep it in its projects' configured output folders, i.e. \bin\Release, etc.<br />
<br />
Also, I spent some time trying to get the solution's directory that's being built.<br />
<br />
To get TFS's Build not to override the output directory, add the following in your TFSBuild.proj in the first PropertyGroup section:<br />
<CustomizableOutDir>true</CustomizableOutDir><br />
<br />
Here are a few things you can do when writing your own custom MSBuild project file:<br />
<PropertyGroup><br />
<SolutionDir condition=" '$(IsDesktopBuild)' == 'false' ">$(MSBuildProjectDirectory)\..\</SolutionDir><br />
<MSBuildCommunityTasksPath>$(SolutionDir)\Third Party Extensions\MSBuildCommunityTasks\</MSBuildCommunityTasksPath><br />
</PropertyGroup><br />
<br />
The SolutionDir is only set if this is a TFS Build (hence the '$(IsDesktopBuild)' == 'false' part). TFS doesn't set this variable. TFS does have a MSBuildProjectDirectory. This has worked for me so far.<br />
If you need to reference some custom task file like MSBuildCommunityTasks, you can then make use of the $(SolutionDir) variable, as shown above.<br />
<br />
Now that the projects are being built in their respective folders, you might want certain output to be generated so that you can do a release. You might for instance want all the installers to be copied to the Results path so that you can install it on the relevant test or distributed environments. So in each project that you want output from, insert this as AfterBuild Tasks:<br />
<br />
<Target Name="AfterBuild" Condition=" '$(IsDesktopBuild)' == 'false' "><br />
<Message Text="Copying output files from $(OutDir) to $(TeamBuildOutDir)" /><br />
<ItemGroup><br />
<FilesToCopy Include="$(OutDir)\*.msi" /><br />
</ItemGroup><br />
<Copy SourceFiles="@(FilesToCopy)" DestinationFiles="@(FilesToCopy ->'$(TeamBuildOutDir)\$(AssemblyName)\%(RecursiveDir)%(Filename)%(Extension)')" /><br />
</Target><br />
<br />
Another nice feature that I discovered while browsing through the MSBuildCommunityTasks collection is the ability to set a version number automatically. There are various provided options but the one with the least configuration and storage of info is this one that I'm using:<br />
<br />
<Target Name="UpdateBuildVersion" Condition=" '$(IsDesktopBuild)' == 'false' "><br />
<Version BuildType="Automatic" <br />
StartDate="$(BuildStartDate)" <br />
Major="1" <br />
Minor="1"><br />
<Output TaskParameter="Major" PropertyName="Major" /><br />
<Output TaskParameter="Minor" PropertyName="Minor" /><br />
<Output TaskParameter="Build" PropertyName="Build" /><br />
<Output TaskParameter="Revision" PropertyName="Revision" /><br />
</Version><br />
<Attrib Files="Properties\AssemblyInfo.cs" Normal="true" /><br />
<FileUpdate Files="Properties\AssemblyInfo.cs"<br />
Regex="(\d+)\.(\d+)\.(\d+)\.(\d+)"<br />
ReplacementText="$(Major).$(Minor).$(Build).$(Revision)" /><br />
</Target><br />
<br />
Calling this from your built project's BeforeBuild task, will let TFS Build (only) to overwrite your Assembly Info and set the new version number and then do a build. Now you don't have to clutter your check-ins and you don't have to remember to set your version numbers anymore. By using a value from $(BuildStartDate) of the format YYYY/MM/DD, you can have a number increment on every build which equates to the amount of days since the $(BuildStartDate). You'll also note the 'Attrib' task. This is to set the file's attribute to normal because TFS checkouts usually sets the file's read-only flag to true and then all your apps will throw an exception because they "can't" write to a read-only file. Same with TFS Build.<br />
</span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-85124353098337272602010-06-27T22:04:00.000+02:002010-06-27T22:04:22.767+02:00Config Encryption for .NetI know there are many examples of configuration file encryption on the net but I needed some place where I can go to remind myself how it works again without having to Google for long periods again in the future to figure stuff out.<br />
<span id="fullpost"><br />
I want to write about Executable configuration encryption and Web configuration encryption. It is actually simple but there are a few things you need to know before diving in. Executable and Web encryption (through the standard way) cannot be mixed, you can't for instance point to a web project in order to open with the ConfigurationManager and vice versa with the WebConfigurationManager. This is pretty obvious but sometimes when you're working with deployment code, you are sometimes tempted to try one with the other.<br />
<br />
Secondly, when using the ConfigurationManager.OpenExeConfiguration() you have to give the full path to the EXE file. This EXE file must be found along with the configuration file.<br />
With the WebConfigurationManager.OpenWebConfiguration() you have to give a full or relative path to an IIS Virtual Directory. If you just want to reference the Virtual Directory in the root path from DefaultWebsite, just add the '/' before the Virtual Directory name. This Virtual Directory needs to point to a directory with the web.config file.<br />
<br />
Now once you have an instance of a Configuration (via ConfigurationManager or WebConfigurationManager) you can now finally decide which section you want to encrypt and encrypt it.<br />
<br />
Configuration config = GetConfgiruation(); // Do as explained above<br />
ConfigurationSection section = config.GetSection("appSettings"); // Example<br />
SectionInformation sectionInfo = section.SectionInformation;<br />
if(!sectionInfo.IsProtected)<br />
{<br />
sectionInfo.ProtectSection("DataProtectionConfigurationProvider");<br />
sectionInfo.ForceSave = true;<br />
config.Save(ConfigurationSaveMode.Full);<br />
}<br />
<br />
There you have it. Just one thing though. You can't copy this file to another machine and attempt to decrypt it because .Net uses a generated token on your Machine to encrypt/decrypt.<br />
</span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-68434319757215142842009-12-15T14:11:00.000+02:002009-12-15T14:11:33.237+02:00How am I now?To those who've felt that God looks at you in a certain way and all you can think is "How am I now?"<br />
<span id="fullpost"><br />
Ever since we could remember from the first time we could talk, we've been involved in a thought tug-o-war where we can just look at ourselves and wonder if we're good enough. I could remember it when I was young, how I would think what others would think of me and I would wonder if I am good enough for them.<br />
Isn't it weird how we humans can think such thoughts? I mean, we see our parents and friends around us and yet we wonder "am I good enough for them?" Some may think that they don't have that problem but I think all of us had this encounter in our relationship with God. "Am I good enough now, God?", "How about now?"<br />
<br />
I mean you keep on thinking that God would look at you with angry or disappointed eyes and no matter how hard you try, you just can't get close to God. Even as a child of God knowing that His Son payed for your sins, you still wonder if you're good enough.<br />
<br />
I was out with my aunt and her husband one night to buy pizza and I just couldn't help but think that God is angry with me for some reason, and if He was, He had every right to be because I am still sinning and doing things that He doesn't like. So I stood outside the pizza place looking up into the night sky, with the chilly wind blowing over my body and thinking "How do I always manage to end up in this situation?" For years, this constant nagging of how God is disappointed or angry with me had driven me to total and complete outbursts of anger and head-banging frustration where I would yell at myself saying "You fool, you idiot! You can't do anything right!" (etc.) and time would go by when I would feel so close and loved by God that I can just say "Wow, You're amazing God! I want to be with You!".<br />
<br />
I've read books, listened to MP3s, praying to God and crying over this issue many times and for many months and still I sometimes wonder "why?"<br />
<br />
So WHY do I feel this way? Am I the only one who feels like God isn't proud of me or that He will only allow me close to Him if I do well enough? (no matter how hard I try)<br />
<br />
I had to look at a few things to answer that question and it came to me not as a quick and straight answer. It took months before I finally realized that it's a simple and important issue. The questions ultimately is "Who am I?" or rather it should be rephrased (for those who're born again) "Who am I in Christ?"<br />
<br />
As I am writing this post, I still feel like what I'm writing and I think that as my fingers stroke over the keyboard, some old thoughts begin to wake up to remind me of what I learned and experienced. Yeah, it has been a dramatic beginning of this post but I feel that sometimes you need to go the extra mile to demonstrate your point.<br />
<br />
You see, the people who think so lowly (or even highly) of themselves, are either reading the Bible on a casual basis where its just "Oh! That's interesting to know" or on a duty basis "OK, I read it, lets go on". I do both at times and its basically as good as not doing it at all. But there are so many good things in the Bible that we're missing and we just don't know how to take it in or we don't realize the importance of it or we just don't bother.<br />
<br />
A few months ago, I started to read Colossians 3 where Paul said "Since you've been raised to new life with Christ..." I din't realize the importance of it. You know, it's all "blah-blah, yeah I know this stuff since I was born again, so what?" but allowing the Holy Spirit to lead me I read it again, and again, and again... I even followed some of the advice given to me from some authors of a META-YES article that I would say out loud "I have been raised to new life with Christ! YES! AMEN!" and after a while something in my mind would CLICK! All the books I've read, sermons I've listened too, etc. finally made 1 connection point in my mind! Colossians 2:20 talks about "You have died with Christ" and then Colossians 3 "you've been raised to new life with Christ". See the picture? You died and you got raised. I had to realize this.<br />
<br />
So then I questioned the way I thought about myself before, how I would condemn myself over every stupid small little thing. Why do I do it? That's how we were before Christ. Now we died (when we accepted Christ as Lord and Savior) and got raised to new life with Him. We're new! Brand spanking NEW! The old messages don't hold anymore! I don't have to feel so condemned and sad anymore. Did this message sink in the first time? NO! I am still (months later) going through this concept because I still feel like God can get angry and disappointed at me. I also struggle to go through this every day. But this has changed my perspective about the Gospel and this is a basic thing that needs to be known by all Christians, otherwise you will continue to condemn yourself.<br />
<br />
Our reverent once preached a message about "Praise be to God! How great am I". He said that if he was one of the people listening to this message even he would leave the church but this is something that God revealed to him in Psalm 139. The Psalm writer starts with God knowing everything including everything about us. Then he writes about wanting to run away that you can't escape God. Then he talks about how God created him. Then he says <a href="http://www.biblegateway.com/passage/?search=psalm%20139:14&version=31">"I praise you because I am fearfully and wonderfully made"</a>. Then he talks about how great God's thoughts are.<br />
He said that the reason why we can't accept the fact that we can be seen by God (in our whole being) as great is because we don't understand the baptism. And that was just a confirmation on what I was going through myself. We don't realize the importance of the death and resurrection power of Christ.<br />
<br />
I write this not because I wish to preach to anyone but I had the need to write it down for myself and maybe even for someone else. God really, really loves (and even likes) us all! May God lead you into realizing the power of the death and resurrection of Christ!<br />
</span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com1tag:blogger.com,1999:blog-27947907.post-30985810466898500162009-03-19T09:33:00.007+02:002009-03-19T19:54:09.240+02:00Ruby class method extensionsI have developed a liking to Ruby since I first started using it for automation and now I even started to use it at work for one conversion process. Unfortunately, there are some set backs I've found with Ruby, such as using the Time class. I think my disliking of using it is probably because I've been spoiled with the well developed C# one. It lacks a lot of useful things. However, since Ruby is dynamic, I could make some of the necessary changes myself.<br /><span id="fullpost"><br />I had to do some extensive operations with the Time class and even though it had a lot of features, it lacked the ones I used the most. It got so bad that at a point, I had to start using Ruby's method extension feature which helped to solve my problem to a great extent.<br /><br />I would however, like to ask the Ruby developers to clean up their Time class (I am not the only one saying that, just do a google on Ruby's Time class and see what I mean).<br /><br />To insert class methods is easy. Let me show you:<br /><pre><code><br />class Time<br /> class << self<br /> def some_method()<br /> end<br /> end<br />end<br /></code></pre><br />So now I can do this: <code>Time.some_method()</code><br /><br />This allows me to insert custom Time creation methods where I can specify a time zone offset along with the time data I want.<br /><br />What about some instance methods? How can I add for instance a date() method where I can tell Time.now to just give me the date component? Adding a class method won't help here. This requires a little hack (in my opinion).<br /><br />First the Module:<br /><pre><code><br />module TimeInstance<br /> # Converts the time to UTC and converts it<br /> # into epoch in milliseconds<br /> def to_epoch_millis()<br /> (to_f() * 1000.0).to_i()<br /> end<br /><br /> # Gets only the Date component of the current<br /> # time instance<br /> def date()<br /> Time.local(year, month, day, 0, 0, 0, 0)<br /> end<br />end<br /></code></pre><br /><br />And in the Time class:<br /><pre><code><br />class Time<br /> ...<br /> class << include TimeInstance<br /> end<br />end</code></pre><br /><br />Now I can say: <code>Time.now.date()</code><br /><br />Now whatever you add in the TimeInstance module, will be added to the Time class's instance method list. The only catch is, you can only call public methods from the Time class in your module.<br /><br />But this solves my problem greatly.<br /><br />Hope this has helped you.<br /></span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com1tag:blogger.com,1999:blog-27947907.post-60474382393563624862009-01-30T17:37:00.004+02:002009-01-30T17:44:49.563+02:00OpenDialog in RubyI have encountered some issues trying to get Ruby to open up an Open Dialog Box.<br />I tried doing it the DL route but apparently there is some problem with Ruby properly creating the struct to be passed to the 'GetOpenFileNameA' function (at least, that's what I've encountered). But I have found a different way...<br /><span id="fullpost"><br />Fortunately for me, I have delved into AutoIT scripting which allows me to create an Open Dialog Box. So I then decided to write a simple script to pass all the necessary params to this application from Ruby (i.e. Dialog message and filter) and the AutoIT application returns the filename that is selected or nil if canceled.<br /><br />AutoIT code:<br /><code><br />If $CmdLine[0] < 1 Then<br /> ConsoleWriteError("No arguments given")<br /> Exit<br />EndIf<br /><br />$op = $CmdLine[1]<br /><br />Switch($op)<br />Case "open"<br /> If $CmdLine[0] < 3 Then<br /> ConsoleWriteError("open command requires message and filter arguments.")<br /> Exit<br /> EndIf<br /><br /> $msg = $CmdLine[2]<br /> $filter = $CmdLine[3]<br /> $selected = FileOpenDialog($msg, "", $filter, 1)<br /> <br /> If @error Then<br /> ConsoleWriteError("Open Dialog problem")<br /> Exit<br /> EndIf<br /> <br /> ConsoleWrite($selected)<br />EndSwitch<br /></code><br /><br />Ruby code:<br /><code><br />f = IO.popen("controls.exe open \"Select a file\" \"Text File(*.txt)\"")<br /><br />puts f.gets<br /></code><br /><br />This seems to work nicely. A bit of a round-trip but allows you to get what you need.<br />For those who don't know, AutoIT is a Windows-based automation scripting system (console and GUI wise, see some of my AutoIT posts).<br /><br />Cheers!<br /></span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com3tag:blogger.com,1999:blog-27947907.post-20989194340112188152008-12-29T17:52:00.008+02:002008-12-29T18:19:52.582+02:00Line ControlMan, ever since working with Open SuSE, I always wanted a solution that could allow remote clients to let a (non SuSE) Linux Gateway dis/connect from/to the internet. Thankfully I found a solution for Ubuntu that works just as well.<br /><span id="fullpost"><br />I don't know how many people who have a Linux Gateway have a need for something like this but I wondered if I would able to find something like this.<br />Let me first explain what I am blabbering on about.<br /><br />I have multiple home PCs and each want internet access. Unfortunately my internet device is a USB one so I can't buy a router and use that, so I needed a PC that was dedicated to be on the internet when I want it. I didn't want the internet to be online 24/7 for security reasons and also connection stability reasons (sometimes the connection quality drops and so a quick disconnect & reconnect sometimes solves this problem).<br /><br />OpenSuSE had a SMPPPd solution where you have KInternet clients (where KInternet is so far only a SuSE app) that connects to a SuSE Gateway which is running SMPPPd that handles the internet connection. Once a client has connected to that Gateway, s/he can control the internet connection and see what the traffic looks like in KB/s. The problem with this solution is... It's only for SuSE! So I needed something similar for Ubuntu.<br /><br />The solution I found was by accident as one can see in this forum thread: <a href="http://www.linuxquestions.org/questions/linux-software-2/visual-real-time-traffic-monitor-693051/">Visual Real-time traffic monitor</a><br />I was looking for a realtime traffic monitor and hoped to just write my own app that can deal with the connections but thanks be to God (I have prayed for something like this, where I asked God to help me get this Gateway back up), I stumbled on an client app called <a href="http://metz.gehn.net/projects/qlinecontrol/">QLineControl</a> which is a Qt based app for Windows and Linux that acts as a client for Line Control. You can download the Windows version and you can get an "unstable" version from apt-get by adding the repository listed on that website.<br />From there I was led to <a href="http://linecontrol.sourceforge.net/">LineControl</a> (the server is called LineSrv) which is the Linux service which actually controls the internet connection. LineSrv (so far) is listed as an official Ubuntu package which you can get from apt-get.<br /><br />It took a while to figure out what to do but thankfully I managed to get it to work.<br />The config file generated by the apt-get for LineSrv is faulty so you have to override with the default config file and go from there.<br />Here is what I did:<br /><br />I copied the /usr/share/doc/linesrv/linesrv.conf to /etc/linesrv/.<br />Then I created 2 scripts for dialing up and disconnecting:<br /><br /><u>Dialup script</u><br /><code>#!/bin/sh<br />ifup ib0 2> /dev/null > /dev/null</code><br /><br /><u>Hangup script</u><br /><code>#!/bin/sh<br />ifdown ib0 2> /dev/null > /dev/null</code><br /><br />I placed them in the /etc/ppp path.<br />The ib0 is my iBurst (internet device) interface, I have to do it like this otherwise it won't work, I am using the Debain dialer. Also LineSrv has to be root for this to work. Fortunately the init script that is setup via apt-get does that automatically.<br />I know the script looks funny but this is the script format that was followed in the sample scripts found in the LineSrv source files.<br /><br />Then I modified the /etc/linesrv/linesrv.conf file:<br /><br /><ul><br /><li>I set user_accounting to no since I don't want ppl to authenticate when dialing up</li><br /><li>I set currency to ZAR (Since I am from South Africa ;-) )</li><br /><li>I uncommented the 'line T-Online' line, you can call it anything you want after the 'line' part</li><br /><li>I uncommented the script_up, script_dn and interface and pointed them to the appropriate dialup, hangup scripts and the interface points to ppp0</li><br /><li>I uncommented 'con_type' and set it to 'netdev'</li><br /><li>I uncommented 'send_throughput' and set it to 'yes' since QLineControl client want this to know at what speed the internet traffic is heading</li><br /></ul>And then I ran the LineSrv service and there you go. I connected with QLineControl just fine without any hassles.<br /><br />And now I am writing this post from this very configuration within Linux. I am quite surprised that such a solution even exists as I really thought that I would have to write my own app.<br /><br />Well, there you go!<br />Cheers and God Bless!<br /></span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-61883976300081527882008-12-06T21:25:00.003+02:002008-12-06T21:40:00.434+02:00How will I go with this?Yeah, how will I go with this blog?<br /><span id="fullpost"><br />Its a difficult time for me to determine how this blog is going to head. The last entry was 8 months ago because I lost interest in blogging.<br />Sometimes I do have some topics to write about but end up discouraged to do so via lack of time or fatigue. You know how it is, right?<br /><br />So just to let everyone know, I am not sure when my next entry is going to be or whether this blog is going to continue to be updated. It will however remain up for people to read.<br /><br />I also fixed the tag image issues that I had with the Digg and Delicious tagging.<br /><br />All I can say is, check in once a week if you want to or subscribe this blog to your RSS reader to detect new additions. I am sorry folks, I am trying. :)<br />I am sure God will lead me with this as well. Maybe I might start a new blog, who knows!<br /></span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-17769109912931369232008-05-09T12:57:00.004+02:002008-05-09T13:10:23.924+02:00Batch Scripting TipsHere are some BATCH script tips which I discovered on the web that helped me a lot in Windows.<br /><span id="fullpost"><br />Why did I use BATCH scripts? Why not Ruby or Python, or even JScript? Well, if you're writing some basic automation which should be run on deployment PCs, etc. BATCH files are standard and sufficient enough to work. Installing Ruby, etc. on all the machines first is a pain and an unnecessary step (IMO).<br /><br />I am keeping this for future reference. There is a website that is dedicated to this kind of thing: <a href="http://www.robvanderwoude.com/">http://www.robvanderwoude.com/</a><br /><br />Now I assume you have basic BATCH scripting knowledge.<br /><br /><b>Hiding Commands</b><br />If you want to hide all the ECHO and COPY, etc. commands from being displayed, insert this in the top line of your script file:<br /><br /><code>@ECHO OFF</code><br /><br /><b>Printing an Empty line</b><br />Sometimes you want to produce an empty line in the console output. This can be accomplished by:<br /><br /><code>ECHO.</code><br /><br />Note: The . (DOT) is directly after the ECHO command and has no spaces in between!<br /><br /><b>Variables</b><br />If you have a variable to hold certain values, to set it you type:<br /><br /><code>SET MYVAR=SOME VALUE</code><br /><br />You would preferably type the value without quotes, since the quotes will be included in the value.<br />Using a value:<br /><br /><code>ECHO %MYVAR%</code><br /><br />Which should output:<br /><br /><code>SOME VALUE</code><br /><br /><b>User input</b><br />If you would like the user to type in something, you use the /P option of the SET command:<br /><br /><code>SET /P CHOICE=Type a letter and ENTER: </code><br /><br />This will output:<br /><br /><code>Type a letter and ENTER: </code><br /><br />Now the user can type in something and press ENTER. This will store the typed in text in the variable CHOICE.<br /><br /><b>Substring</b><br />If you want to take a substring from a variable, you can do so by:<br /><br /><code>%CHOICE:~0,1%</code><br /><br />This will take the 'User Input' sample's CHOICE variable's 1st character. As you have noticed, it starts with the variable's first index (0) and by using length (1), like in Java's substring() method, you will get the first character of the variable.<br /><br /><b>If statements</b><br />Now, if you want to do a check by comparing a variable's value by a certain string, you can make use of the IF command.<br /><br /><code>IF /I '%CHOICE%'=='A' GOTO CHOICEA<br />IF /I '%CHOICE%'=='B' GOTO CHOICEB</code><br /><br />CHOICEA and CHOICEB are just labels to where the batch process should jump to if the given conditions are true. It doesn't have to be GOTO statements, it can be single statements, such as ECHO or SET. The /I option tells the IF statement to do a case-insensitive comparison. If you compare your variable against a string, you have to place it inside quotes, like above.<br /><br /><b>Labels</b><br />A label is a place to where the batch processor jumps to after executing a GOTO statement. Example:<br /><br /><code>:CHOICEA</code><br /><br /><b>Current path variable</b><br />This will output the current directory:<br /><br /><code>ECHO "%CD%"</code><br /><br /><b>Path of batch file</b><br />Sometimes you want to work relatively from the path of the batch script file, rather than the current directory.<br /><br /><code>ECHO %~dp0</code><br /><br />This will output the path of the batch file that is running.<br /></code></code></span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-83671469866921143632008-05-01T20:43:00.007+02:002008-05-02T11:31:44.268+02:00Ruby and Win32 APIIf you are using Ruby as an automation process rather than a development tool, you sometimes might want to use some of Windows' GUI controls, such as a message box or folder browser box. In those cases, you might want to try the DL library.<br /><span id="fullpost"><br />Some of you have read <a href="http://lastattacker.blogspot.com/2008/03/ruby-ruby-ruby.html">this post</a> about OLE Automation and DL. In a way it is quite simple but it can take a while to get right, especially if you're a beginner like me. However, after some time I have managed to get my folder browser to work and I haven't found Ruby code on the web that does this yet.<br />However, I feel like it is rather simple to do and to find out how to make your own version, all you need to do is to see how people who wrote VB code do it.<br /></span><span id="fullpost">Why? Because it is that straight forward, in fact, Ruby reduces the amount of lines of code to do it.<br /><br /></span><span id="fullpost">I must warn and say that doing this kind of programming requires excessive use of the Win32API docs (one form or another) and some skilled programming, especially in the C-language area, because you are interfacing to the actual C-functions from Ruby.<br /><br />Many VB code snippets that does this, have referenced these 2 c-functions (from the shell32 DLL):<br /><ul><li>SHGetPathFromIDListA</li><br /><li>SHBrowseForFolderA</li></ul><br />They also require a structure to send data to the BrowseForFolder function.<br />Here is a <a href="http://www.freevbcode.com/ShowCode.asp?ID=3064">site</a> to get you started.<br /><br />Why don't I just paste the code? Well, actually the method I wrote to bring up the dialog box, requires a whole Module and I would like to write my own Ruby module before I publish anything.<br />Yeah, I might sound like a bugger but hey, I have posted lots of lines of code on this site before so... take it like a man! ;)<br />The hardest part is creating a Ruby C-like structure from the VB structure, so I think I'll help you out on that one:<br /><code></code><pre><br />ptr = DL.malloc(DL.sizeof('LLSSLLLL'))<br />ptr.struct!('LLSSLLLL', :br_hOwner, :br_pidRoot, :br_displayName, :br_title,<br /> :br_flags, :br_fn, :br_lparam, :br_iImage)<br /></pre><br />Now don't say I didn't give you anything! :D<br /><br />For those who still don't know what all those L's and S's are for, it is basically saying "This is a Long integer type" or "This is a string type". Its to determine the size of the structure, but you know that there are other data-types so you need to dig in on your own regarding that.<br /><br />Now there is one thing I'm having trouble with and it is the Open/Save File Dialog box. Aparently if you take the exact same data-types as the prescribed docs say, Ruby fails to bring it up. After hours of struggling, I decided to skip the VB code and look on the web if someone already did this, and to my "surprise", nobody has posted any code on this. Bummer! So I decided to have a look on the MSDN site, and BAM! I found my answer. The reason why Ruby didn't bring up my dialog box was due to the fact that Ruby created a structure that had a different size than what the function was expecting! So now I am trying to find out where, how and why.<br /><br />I might post my code and findings at a later stage, for this is a necessary thing for Windows Ruby Automation Programmers, like me! ;)<br /></span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-48742222240008090622008-04-30T17:41:00.001+02:002008-04-30T17:43:03.718+02:00My "facial expression"Someone sent me this link which I rather think is funny.<br /><a href="http://blogs.microsoft.co.il/blogs/tamir/archive/2008/04/28/computer-languages-and-facial-hair-take-two.aspx">Computer languages and facial hair</a><br />Hmmm... good thing I'm growing mine! :DDandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-50500758882643929582008-04-30T17:25:00.002+02:002008-04-30T17:29:10.221+02:00Netbeans 6.1As if <a href="http://www.netbeans.org">Netbeans</a> 6.0 wasn't enough to patiently wait for (not in a bad way), the new 6.1 is ready for download/order!<br />Check this <a href="http://www.artima.com/forums/flat.jsp?forum=276&thread=229787">link </a>out to find out more of what they did in this version.Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-59873838906145962972008-04-30T16:07:00.012+02:002008-05-02T11:36:52.518+02:00AutoIT Script for EasyWorship<a href="http://www.easyworship.com/">EasyWorship</a> (EW) is a wonderful app for church services and beats Powerpoint in that it can display Powerpoint slides on a different monitor (than your primary for the projectors) and you can view all the slides in advance of what it beholds. This is great unless you want to import some old songs from a Word document or Powerpoint slides into its Song database...<br /><span id="fullpost"><br />Well why not just import the Powerpoint slides and use that? Well in my case (as I've been doing this at my church for over a year now) this can take a long time in preparation and is very error prone. What we usually did was create a Powerpoint slide and create our whole church service presentation in it, which meant opening up the Word or Powerpoint Doc with the original songs inside, search for it and then copy-paste. Sometimes we accidentally took the wrong songs (like Psalm 256 instead of 265) and found out in the Sunday morning service! :D<br />With the EW Song DB, you can type in the song title and you just drag it into your schedule. Thats it! Save me about ... hmm... 3-8 minutes per song!<br />Also this means that if we imported the wrong song and found out the Sunday morning, we can correct it in a matter of seconds!<br /><br />We already have all our Psalms and Songs on Word Doc and Powerpoint and its not 1 song per doc, its a hundred at least! EW can only import 1 thing at a time and they haven't released a tool that can do convertions and imports for you like we needed so I searched the web to find out that everyone else who has the same problem as I did, import it manually! Man, I can't imagine importing over a 1000 songs manually by copy & paste! 8-0<br />So I stumbled on <a href="http://www.autoitscript.com/autoit3/">AutoIT</a>. This is a wonderful util to automate just about any task. By writing a BASIC script (pun intended) you can tell the mouse pointer to move to a certain window's control and wait for a while and then issue a click action. Now that's what I mean by GUI automation ;-). You can also do basic scripting automation like a BATCH or BASH script can.<br /><br />Now back to my scenario... I played around and found how easy it actually was to write a script that can import all my hundreds of songs in minutes (it literally took just over 20 mins to import over 800 songs!) since there wasn't a way for me to to it programatically in EW. This script is tested on EW 2006, so if you want to do the same kind of thing like I did, maybe your fortunate to have Google'd onto this page :D<br /><br /><code></code><pre><br />#cs<br />A little script to import songs into Easy Worship 2006.<br />Written by Dandre Jansen van Vuuren<br />#ce<br /><br />;Select the files to import<br />$var = FileProcessSelectionDialog()<br /><br />;Cancelled<br />If $var == -1 Then<br />MsgBox(0, "Error", "No files selected, quitting...")<br />Exit (1)<br />EndIf<br /><br />$selectedSourceFolder = False<br />$sourceFolder = $var[1]<br /><br />StartEasyWorship()<br /><br />;Iterate through all the selected files to import<br />$total = Number($var[0])<br /><br />For $i = 2 To $total<br />$curFile = $var[$i]<br />SelectNewSong()<br />OpenFileOpenDialog()<br />$ext = MapFileTypeToTypeName(GetExtensionFromFile($curFile))<br />SelectAFileFromOpenDialog($curFile, $ext)<br />WinWaitActive("New Song")<br />Send("!o")<br />WinWaitActive("EasyWorship")<br />Next<br /><br />MsgBox(0, "Progress", "Finished.")<br /><br />Func FileProcessSelectionDialog()<br />$filter = "HTML Files (*.html;*.htm)|Word 97-2002 (*.doc)|Text Files (*.txt)"<br />$importFiles = FileOpenDialog("Select the files to import into EasyWorship", "", $filter, 1 + 4)<br /><br />If @error Then<br />return -1<br />Else<br />If StringInStr($importFiles, "|") Then<br /> return StringSplit($importFiles, "|")<br />Else<br /> ;A single selected file isn't in the same form as a multiple<br /> ;selection of files.<br /> $pos = StringLastIndexOf($importFiles, "\")<br /> $folder = StringLeft($importFiles, $pos)<br /> $file = StringMid($importFiles, $pos + 1)<br /> $newString = $folder & "|" & $file<br /> return StringSplit($newString, "|")<br />EndIf<br />EndIf<br />EndFunc<br /><br />Func StartEasyWorship()<br />Run("C:\Program Files\Softouch\EasyWorship\EasyWorship.exe")<br />WinWaitActive("EasyWorship")<br />EndFunc<br /><br />Func SelectNewSong()<br />Send("!s")<br />Send("n")<br />WinWaitActive("New Song")<br />EndFunc<br /><br />Func OpenFileOpenDialog()<br />;The open button doesn't have a shortcut<br />;find out where the window is positioned And<br />;relatively position the mouse onto the open button<br />$winPos = WinGetPos("New Song")<br />MouseMove($winPos[0] + 305, $winPos[1] + 45)<br />MouseClick("left")<br />WinWaitActive("Open")<br />EndFunc<br /><br />Func SelectAFileFromOpenDialog($file, $type)<br />Send("!t")<br />ControlCommand("Open", "", "ComboBox3", "SelectString" , $type)<br />sleep(10)<br />Send("!n")<br />Sleep(10)<br /><br />;We only need to specify the folder where all the files<br />;lie, once. From there on we can import the files one<br />;at a time.<br />If $selectedSourceFolder == False Then<br />Send($sourceFolder)<br />Send("{Enter}")<br />Sleep(10)<br />$selectedSourceFolder = True<br />EndIf<br /><br />Send($file)<br />Send("!o")<br />EndFunc<br /><br />Func GetExtensionFromFile($filename)<br />Return StringMid($filename, StringLastIndexOf($filename, ".") + 1)<br />EndFunc<br /><br />Func StringLastIndexOf($string, $char_target)<br />$strlen = StringLen($string)<br />For $i = $strlen to 1 Step -1<br />$char = StringMid($string, $i, 1)<br />If $char == $char_target Then<br /> return $i<br />EndIf<br />Next<br />EndFunc<br /><br />Func MapFileTypeToTypeName($fileType)<br />Switch StringLower($fileType)<br />Case "html"<br />return "HTML Files"<br />Case "htm"<br />return "HTML Files"<br />Case "doc"<br />return "Word 97-2002"<br />Case "txt"<br />return "Recover Text from Any File"<br />Default<br />return "Unknown"<br />EndSwitch<br />EndFunc<br /></pre><br /><br />Here is how the script works (you obviously need AutoIT and EW):<br /><ul><br /><li>Run the script</li><br /><li>Choose the files you would like to import, EW only has a limited supported file-base, but includes HTML and Word Docs. I reformatted all my songs to HTML (I'll write a new article on how I automated that process).</li><br /><li>After selecting the files and clicking on Open, leave everything! You'll see your mouse pointer and menu-popping in action. :-)</li><br /><li>Once it is done, it will pop up with a "Done" message box. In the mean time don't let anything take control of your keyboard, mouse, etc (including you ;-) ). This script doesn't cater for problematic scenarios!</li><br /></ul><br /><br />I don't mean to be full of myself (really I don't!) but I am glad that God made me a programmer so that I wouldn't have to do these kind of tasks manually! :D<br /></span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com7tag:blogger.com,1999:blog-27947907.post-13065966109983968722008-04-28T14:36:00.006+02:002008-04-28T15:16:11.206+02:00New (K/X)Ubuntu 8.04This weekend I've spent some of my soft-cap downloads on getting the latest Ubuntu software (well I didn't get Ubuntu itself as I am not such a fan of Gnome) such as Xubuntu and Kubuntu, version 8.04 of course...<br /><span id="fullpost"><br />After leaving my Linux box overnight I managed to download Xubuntu (i386 - Desktop); Kubuntu (KDE 3.5; i386 - Desktop) and its KDE4 version (also i386 and currently as I'm typing downloading the 64bit version at 6Kbps ;-) ).<br /><br />After obtaining Xubuntu, I ran a CD check and saw that 1 file was 'corrupt' (as in MD5 values didn't match). So I downloaded it again only to find the same problem, but when I did a MD5 hash on the ISO file this time and on the Xubuntu website, it was the same, so I guess the guys @ Xubuntu need to do a fix on that file but unfortunately I don't know if it is a text file or binary file (hopefully a non-important one).<br /><br />So while I was waiting to download the KDE 4, Kubuntu, I installed the KDE 3 version of Kubuntu and I was quite impressed. I am not such a big fan of KDE 3 either but in Kubuntu 8, it sort of had a slight of change to what I was used to. The speed at which things operated, the fact that it quickly picked up all my hardware was great. All that the Ubuntu Linux OSs need is an official nice looking GRUB loader (but apparently one can get one with Apt-Get). Kubuntu even asked me if it should download the nVidia drivers for my 6200 card (yeah I know but I don't play games so actively anymore plus its sufficient for what I'm doing) and voila!<br /><br />I even had a whack at the special desktop effects and its lookin good except for the fact that it is unstable :(<br />Then when the KDE 4 version was ready I immediately installed it over the KDE 3 version and working and seeing KDE 4 for the first time in action was just WOW! Visuals, speed, configuration, etc. was just great. I downloaded the nVidia driver so that I could have a crack at the desktop visuals and it looked ok'ish, besides the fact that it too was unstable. Like the OpenGL version would crash almost instantly while the RenderX (I think thats what it is called) works pretty well but doing something like pressing Ctrl+10/11 (to have your windows minimize on the screen as on the Mac OSX desktop) would only show 1 window instead of the 3/4 thats open. Other than that I am quite impressed with KDE 4 and the new Kubuntu.<br /><br />Xubuntu I haven't had a go at yet because I would like to use its fast desktop as my new Linux Gateway over OpenSuSE and/or (K)Ubuntu (as SuSE 10's repository is outdated and no longer maintained and I need updates plus I am getting a little tired of SuSE, and the latest SuSE versions need higher spec machines to run on), so I am still fiddling around on a proof of concept (POC) before man handling my Gateway box ;-). I would like to still have a Remote desktop option when working on the box so thats why I am not using Ubuntu Server and Xubuntu is nice and light weight (maybe even for VNC sessions) so to update is no problem as opposed to SuSE. The only things I am going to miss is the remote dial-up with smpppd (SuseMetaPPP-Daemon), and a few ease of installation GUI screens (maybe even the preconfigured firewall) but I guess thats it, I'll see how much I can duplicate on my POC version before heading over. Also I really hope the guys @ Ubuntu fixed one routing bug where HTTPS web pages didn't masquerade over the local network. This was a common issue on version 7.10 (as I had Ubuntu Server 7.10), I also tried the fix on the website which didn't work for my situation.<br /><br />Well thats all I got for now, didn't spend too much time on this but for those who've waited for the new Ubuntu can be happy at the progress made by the Ubuntu guys for sure.<br /><br />Thanks Mark Shuttleworth (and your cool team, also to everyone who contributed) for such great Distros! If I can get this version as a new replacement on my gateway box, then I am a Ubuntu convert! ;-) It is faster to download 700MB than 3.5GB for newer versions! :D<br /></span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-17129695613411179862008-04-15T09:01:00.003+02:002008-04-15T09:19:22.783+02:00Windows Explorer alternativeFor those who're tired of Windows Explorer, a very nice free alternative I found does what I want it to and more...<br /><span id="fullpost"><br />There are a wide variety of Explorer replacements (or alternatives) that are "better" than Windows Explorer but this one I believe beats all of them in a lot of categories.<br />Ever heard of <a href="http://www.mustangpeak.net/">UltraExplorer</a>?<br />Its a Delphi project (free for windows) and most people believe that Delphi GUI apps perform faster (and there is no exception in this case), although sometimes it might just stall for a while but I think it might be more of an IO stall than a "I'm too busy to listen to you" stall. ;-)<br />Its got a nice appearance, with skinable components (menu and toolbar). It has views that are actually customizable and very useful (except its console, that needs some work but you can get a very nice <a href="http://sourceforge.net/projects/console/">console app</a> from Sourceforge as alternative to Windows').<br />You have tabbed windows support that works just life Firefox's tabs (even with the middle click event). It remembers where it was and has all the Windows Explorer context menus, and so on.<br />It even picks up my USB drives instantly as soon as Windows activates them and is very responsive except maybe during heavy disk IO.<br />I am definitely sticking to this handy tool for Windows, I even removed 'My Computer' and 'My Documents' from my desktop to replace it with 'Ultra Explorer'.<br /><br />Hope you might like it. :)<br /><br />God Bless.<br /></span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0tag:blogger.com,1999:blog-27947907.post-2486785428516808462008-03-31T20:55:00.008+02:002008-05-02T11:37:24.225+02:00Ruby, ruby, ruby ...Yeah it's been a while since the last posting. I was lacking some inspiration on what to blog on or I was just too lazy or too busy to actually log in and blog on something that I wanted to, that is until now...<br /><span id="fullpost"><br />You might ask, whats up with the title? Well I remember the song written by a band called Keizer Chiefs (spelling) named: Ruby. Now that reminds me of the Ruby scripting language which lots of people on the web is going on about. A dynamic typed language with multiple ways of saying one thing.<br /><br />I was among those who agreed that Ruby was stupid, until I wanted to do a few things in Windows which Python nor other scripting languages could offer (or easily accomplish), except Ruby. Some of us would mock the guy who presented a brief crash course in Ruby, saying that it is too dynamic for our taste and it would make debugging a nightmare, etc. but doing some code delving and with the latest <a href="http://www.netbeans.org/">Netbeans</a> language addition, which is Ruby and Ruby on Rails of course, I started to see how cool Ruby actually is.<br />Usually I despised dynamic typed languages until I saw how it can increase productivity and coding speed for smallish scripts, which is what I wanted for automation.<br /><br />"What kind of automation?" you may ask. Well ordinary and OLE automation. Sure <a href="http://www.autoitscript.com/autoit3/">AutoIT</a> is great for GUI and other windows automation but the scripting language is very BASIC (pun intended) lacking structure and (as in, I need structures as in C or C++'s structures or atleast...) object orientation. With Ruby we have good OO support and with the 'win32ole' lib, you can kick VBA and do MS Office automation via Ruby instead. A good starting site is <a href="http://rubyonwindows.blogspot.com/">Ruby on Windows</a> which covers Ruby automation in MS Office. I managed to convert Powerpoint slides to somewhat formatted Word docs via Ruby, just to give you an idea.<br /><br />I think I'll post a couple of script snippets later on, on what I worked on with Ruby and AutoIT for others to see and for future reference.<br /><br />Just to go back to Python, some of you might say that Python does have OLE automation... I had a look at it and it looked very nasty! I wouldn't touch it, unless I looked at the wrong files, and you need to download a library for Python to have OLE automation ability. With Ruby you use the OLE objects exactly as in VBA but within your Ruby context.<br /><br />Currently I am trying to implement a few operations in Ruby to have Browse-For-Folder ability, Open-Dialog, and so on functionality by doing Windows API calls via the DL lib in Ruby. You can catch a quick course on <a href="http://www.jbrowse.com/text/rdl_en.html">DL here</a>.<br /><br />I hope this will help you as much as it helped me.<br />God Bless!<br /></span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com1tag:blogger.com,1999:blog-27947907.post-29493066890447137912008-03-01T20:35:00.005+02:002008-03-01T21:13:54.038+02:00Code::Blocks is released!At last! An official release of Code::Blocks and look'in good!<br /><span id="fullpost"><br />I have downloaded the latest release of the Code::Blocks IDE from the <a href="http://www.codeblocks.org/">site</a> and so far I am pretty impressed by the features and speed of the application. It now features lots of parsers for script editing and compiler languages.<br />I wouldn't know about all the other languages and compile projects but I would mainly use C::B for C++ programming.<br /><br />The Code Completion is much more responsive than before (you might see it from the second time and onward when opening C::B) and rich in data types (the list box that pops up displays everything from #DEFINEs (except their params) to variables and functions (obviously). Unfortunately it doesn't seem to handle templates. Bummer!<br /><br />The wxSmith GUI Editor seems nice enough to use, haven't tried it out completely but it should be sufficient for moderate wxWidgets projects.<br /><br />Well thats all that I have seen for now, haven't went through everything but it seems good enough to use though. I have worked with the nightly versions before and even they were pretty good so now I can only image how much better this version is (and how much more stabler).<br /><br />Unfortunately I don't know how this IDE compares with others (except VisualStudio but I won't go there) but with those that I have seen so far, it is far better than them (also except Eclipse and Netbeans but they aren't native to C++ development, like you can only do C++ and nothing else, no Gui editors for wxWidgets, no library support, etc. but I could be wrong!), however if I were to compare to wxDevC++, I would say that wxDevC++ has a better Gui editor (but then again I only used C::B's editor for a few seconds, not a few days) but C::B has better coding facilities!<br /><br />Cheers and God Bless!<br /></span>Dandréhttp://www.blogger.com/profile/04574047868840250564noreply@blogger.com0