Tuesday, July 03, 2007

Some days ago I was working on procedures that need be executed in a second thread to avoid blocking the application GUI, so I implemented something simple to search files in a "iterative" way.

El otro dia estaba viendo procedimientos que necesitan ejecutar en un segundo hilo para no bloquear la aplicacion, e implemente algo muy sencillo para buscar archivos de manera "iterativa":



using System;
using System.Collection.Generic;
using System.IO;

public class FileSeeker
{

public static string[] RetrieveFilesFrom(string directory, string searchPattern,int level)
{
List filenames = new List();
Stack directories = new Stack()

directories.Push(directory);

while(directories.count!=0)
{
string currentDirectory = directoriesStack.Pop();

foreach(string file in Directory.GetFiles(currentDirectory,searchPattern))
filenames.Add(file);


if((level==-1) || (directories.count != level))
{
foreach(string subDirectory in Directory.GetDirectories(currentDirectory))
directories.Push(subDirectory);
}

}
return filenames.ToArray();
}

}

public class Program
{

public static void Main(string[] args)
{
foreach(string path in FileSeeker.RetrieveFilensFrom(@"C:\Program Files\", "*.exe",-1)
Console.WriteLine(path);
Console.Read();
}

}




Now I'm encapsulating all the behavior in a component with more features, like search using regular expressions, file size, creation time, etc. As soon I finish it, I will write an article for elguille's site.

Did you hear about Prado?



Since I started working with WebForms on ASP.NET, I knew that was the kind of web programing that I really want to do, people call it "event driven". Who cares about html tags if we have the viewstate and all the infraestructure that works on it...

When I started my practice time, I reached the PHP with Ajax using the Xajax framework, really nice times with such a nice framework (believe me, it's awesome) I couldn't stop telling my coworkers: ...it's kind of the code behind..., I make all my webpages with client events that fire server methods: using a couple of lines in javascript and the xajax engine, but ...

During the last two weeks I've been hearing about PRADO in my (then), future work place, PRADO ... it's a framework who won the Zend competition ... Let's check it out! ... Read about it on the web ... Oh, it's inspired in ASP.NET 2.0!!! so ... if it supports all of that beautiful stuff, could we program event driven websites with PHP transparently? ... The answer is Yes!!!

But the event driven part is not all of it. If you would like to work on software components (like I do) and do it the dotNet code-way (like I do), you will be pleased to find that PRADO is software component based, and provides:

A kind of using token (implement as a static method in a core class) to offset the lack of namespace in php:

Prado::using('This.Is.Del.I.Cio.Us.MyClass');

Properties with setter and getter methods:

class TControl extends TComponent {
public function getID() {
...
}
public function setID($value) {
...
}
}


used as:

$id = $component->ID;
$component->ID = $id;

or

$id = $component->getID();
$component->setID( $id );

Event:

$callback = 'myFunctionName'; or $callback = array($unsub,'myFunctionName');

$MyComponent->OnClick = $callback;
$MyComponent->OnClick->add( $callback );
$MyComponent->OnClick[] = $callback;
$MyComponent->attachEventHandler( 'OnClick' , $callback );

This is just the tip of the iceberg, PRADO is a UNIQUE framework, you should try it out. It doesn't support MVC, but it brings event driven to php in an easy an fun way.
If it's inspired on ASP.NET, how else could it be? :-)

Prado is here!

Saturday, August 05, 2006

Paint.net, Cool!!!

Yesterday I had been searching for news about the framework, and I saw this project, Paint.net.
It started developing at Washington State University as an undergraduate senior design project mentored by Microsoft, and it's currently being maintained by some of the alumni that originally worked on it. Originally intended to be a free replacement for the MS Paint software that comes with Windows, it has grown into a powerful yet simple tool for photo and image editing. The programming language used to create Paint.NET is C#, with a small amount of C++ for setup and shell-integration related functionality.

http://www.getpaint.net/index.html

Friday, August 04, 2006

Refactoring in Visual Basic

Here's a good video of the refactoring, a new tool of the vs2005, keep reading

http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20060608vbasicjs/manifest.xml

Wednesday, August 02, 2006

Cool Lib for CoolComponents

I just started working on a new lib for free use, the Cool Lib. As of now, it has two components a MineCamp for a MineSeeker, which I called GoMines (it's very pretty), and a PieChart with 3D style, both components were made entirely in GDI, they dont't use OpenGL. I use Visual Basic 8, but I'm thinking of writing it on C#, it's the same thing in the end. If you want to use any of these Components, contact me. The code for both of them needs to be revised for style, but it does its job. See you around folks.

Destination AJAX

I feel bad, just because of Ajax. I don't know anything about asp.net and less about Ajax and Atlas lib (just the names). But Ajax is cool, very cool, and good stuff to know. You can make a web page with the same GUI as desktop application without the need to refresh the hole page, only the part that you need. Google Maps uses Ajax. As the title says it: New Course is establish, Destination AJAX

Sunday, July 30, 2006

My First Article

Well folks, I just finished my article on Implementation of Generics Types in Visual Basic 8 (or 2005). I hope I can upload it to an important site about the VB.NET. Cross your Fingers. The article is in Spanish. If you would like to read about Generics read in MSDN Online, many spanish speakers can't get information because not every body writes to them ( They are some like me, but you note the difference) So I decided to make a difference (Of Course as IDeal).

Saturday, July 29, 2006

Snow (Hey Oh) My Remix

This the lyrics of song that is included in the Red Hot Chilli Pepper's new Album
I like it some much, because that I can't control my hands and the result is this
Transgenic and Cool lyric, oriented on the dotnet, God Bless DotNet

Come to decide that the language that I tried
Were in my life just to get visual on

When I sit alone come get a new book now
But I need more than delphi this time

Step from the class to the ide to the net
And I do believe that dotnet is on

When I make it on
Come get to play it on
All my life to override

Hey oh listen what I say oh
I got your
Hey oh now listen what I say oh, oh

When will I know that I really can't do
To the well once more time to make on

When it's taking me
When will I really see
All that I need to look msil

Come to believe that dotnet is alive
Before I get my chance to learn it

When it's saving me
What do I really need
All that I need to look msdn

Hey oh listen what I say oh
Come back and
Hey oh look at what I say oh

The more I learn the more I know
The more I like to compile it go hey oh
Wooooaaah

Deep beneath the code of another perfect component
Where it's so my as your

Privately divided by a type so instanced
And there's nowhere to go

In between the code of another perfect module
And it's so my as your

Running through the library where all my functions will
Be implemented and there's not a class to go oh!

When to create a game for a friend
All the projects that have broken down

Now you compile it up
I'm gonna debugging it up
Just to hear you bits it out

Step from the class to the interface to the type
And I do believe what we rely on

When I create it on
Come get to play it on
All my life to innovate

Hey oh listen what I say oh
I dot your
Hey oh listen what I say oh

The more I wing the less I fear
The more I write to let it go hey oh
Wooooaaah

Deep beneath the code of another perfect component
Where it's so my as your

Privately divided by a type so instanced
And there's nowhere to go

In between the code of another perfect module
And it's so my as your

Running through the library where all my void will
Be implemented and there's not a class to go oh!

I said hey, hey yeah oh yeah tell my dotnet now
Hey, hey yeah oh yeah tell my dot now

Deep beneath the code of another perfect component
Where it's so my as your

Privately divided by a type so instanced
And there's nowhere to go

Deep beneath the code of another perfect component
Where it's so my as my own

Running through the library where all my mains will
Be implemented and there's not a class to go oh!

I said hey oh yeah oh yeah tell my love now
Hey yeah yeah ooh yeah

My Dear Platonic and Galatic Love


There is the girl of my dreams, she speak many languages, she is Beatiful (with a V of Very), she is extremely Intelligent. She is also older than me, but I'm willing to fight for her love (Keep Dreaming).

I love you Natalie, I will be your new SkyWalker

CodeSnippet Editor?, God Bless DotNet

Who works with vs2005 and doesn't think of making his own SnippetEditor? (I do) Microsoft is a step ahead of us (of me?) and established a new project, which is shared by the way. We can contribute and also donwload the code, enjoy.

Guidelines for Generics

Kit George, recently posted a guideline of the things that you could and could't do with Generics, this list is for C#

Problems with Index?

Hello Folks, listen to this, I was working with a code for an ImageViewer and I got this exception, a bad exception, specially beacuse I thought my code was good (Also the compiler). I found the solution, check it out. If you put that in listview, the user can only select one item, and if you try to handle the SelectIndexChanged event you might get a surprise, that is, when you select another item, for less than a second the selectedindex array will be empty, then you can imagine what comes next when you put code.
You already know, just put something like this

if listview1.selectedindex.count <> 0 then
'do want you want
end if