Given a planar weighted graph in a metric space (X,d), does the ordering of the areas of the faces preserve (i.e. remains the same) for any continuous mapping f:(X,d)->(Y,d’) where (Y,d’) is some metric space?

If you are both a Haskell and C# programmer then you should be familiar to the filter function in Haskell and the filtering functions in C# (Find,FindAll etc).

```-- the type of filter is : filter :: (a->Bool)->[a]->[a] which means that
-- filter takes a function as an argument and a list and aplies the function to all the elements of the list
-- when the function returns true then the element will be added to the resulting list.
findAllOddElements :: [Int] -> [Int]
findAllOddElements ls
= filter odd ls```

The same code which does the exact same thing in C# would look like this

```List<int> findAllOddElements(List<int> a)
{
return a.FindAll(
delegate(int elem) {
return elem%2==1;
});
}```

We can see that the two functions are very similar, both requiring a function passed as a parameter. However, internally, they work different because Haskell is a functional programming language.
Hence filter is defined like this:

```filter:: (a->Bool) -> [a] -> [a]
filter f [] = []
filter f (l:ls)
| f l = l : filter f ls
| otherwise = filter f ls```

There is a nicer way to define findAllOddElements in C# using Linq like this:

```List<int> findAllOddElements(List<int> a)
{
return a.Where(elem => elem%2==1).ToList();
}```

Assuming the resulting list is not empty then the function Find in C# should be equivalent to the following function in Haskell:

```findAllOddElements :: [Int] -> Int
findAllOddElements ls
= head (filter odd ls) ```

Of course you can use function composition and partial application:

```findAllOddElements :: [Int] -> Int
findAllOddElements
= head . (filter odd) ```

Also we can rewrite the Find function in C# using the Where prototype:

```int findAllOddElements(List<int> a)
{
return a.Where(elem => elem%2==1).ToList()[0];
}```

Hopefully you will find this post usefull!

WinPcap is a very useful tool which can enables users to capture windows packets. On their website they offer a development pack but only for C/C++ programmers. So this is why I decided to write my own (simple) class for capturing packets in C# importing the wpcap.dll . Before showing the code, you must know that in order for your program to run as it should in Windows Vista/7 you must run it as administrator, otherwise it won’t even find the (network) devices.

In order to import the functions we must first define some structures:

```        [StructLayout(LayoutKind.Sequential)]
struct pcap_if
{
public IntPtr next;
public string name; //name of device
public string description; //description of device
public int flags;
}

[StructLayout(LayoutKind.Sequential)]
{
public IntPtr next;
}

[StructLayout(LayoutKind.Sequential)]
{
public Int16 sa_family;
public string sa_data;
}

[StructLayout(LayoutKind.Sequential)]
struct pcap_pkthdr
{
public timeval ts;
public int caplen; //captured length
public int len; //packet length
}

[StructLayout(LayoutKind.Sequential)]
struct timeval
{
public int tv_sec;
public int tv_usec;
}

//some credentials if we want to capture packets remotely
//CAN BE VERY USEFUL!!
[StructLayout(LayoutKind.Sequential)]
struct pcap_rmtauth
{
public int type;
};```

I’m back with a new tool I’ve made. 馃檪

FM Radio Player is a small application designed to play radio stations through plugins. This means any coder can extend the program with new radio stations.

Note: Recording works only on the stations which don’t require AAC+ codec.
You can find information about how to create a plugin in the readme.txt file.

Here are some key features of “FM Radio Player”:

There is much chance that the launch of TOI (aka Training for Olympiad in Informatics see main article here) will be postponed for Tuesday or Wednesday if we don’t finish the articles I considered to be vital. However, we are trying hard to launch it tomorrow. Anyhow, I guarantee it will be worth the wait!

Some insight on SOME articles we are currently writing or we’ve already finished: the Dijkstra algorithm, AVL Trees, Kruskal & Prim, Miller Rabin, Pollard rho, RMQ. The list of the articles goes on and on. 馃檪

Hopefully this project will be a success because we’ve worked very hard on it until now. Many students, teachers and senior software developers from different parts of Romania contributed to its development.

Hy there!! I had some problems with my ISP and because of this wordpress blogs would not load correctly and so I was deprived of writing here.

What’s up?

Some members of Hackpedia and I are working hard to launch by Monday, 22nd of June 2009, a section on the Hackpedia community entitled: Training for Olympiad in Informatics.

This project started in March 2009. Being one of its founders, through this project I wanted to help every participant in the Olympiad no matter if they are competing locally, regionally or nationally and internationally. We are building a complete set of articles which are helpful for the beginners in algorithms but also for those who want to expand their knowledge.

In addition, we will regularly public sets of problems for each level of the competition and also for each grades (9,10,11,12). One or two weeks after each problem was posted the staff will make a complete solution for it (implementation and text). If the user could benefit from the implementation in C/C++ we will write it this way, if not we will provide pseudo code.

Facing problems?

Yes, some. I hope Hackpedia will be up, again, shortly or we will have to postpone the launching. It went down last night. Moreover, in the launch day I don’t think all the articles will be done (6 or 7 will be for us to write in the future). Oh! All the content will be in Romanian. Maybe in the future we will translate some of it in English.

Later edit: Hackpedia is back online. 馃檪

Conclusions?

Hopefully, this section will help some users become better in algorithms. 馃檪

Will be back with updates when we launch!

Did you ever think about declaring a multi-dimensional array dynamically? If so, I have created a class in C++ just for this.

So the problem goes like this: let an array a of type T, declare an array with n dimensions where n was inputted by the user.

The key is to think about a tree.

Both the implementation and an example can be found here:
Generalized Array