Me, Silverlight, ComboCheck-mutant and Frank Sinatra

November 24, 2011

I had the opportunity these days to use a lot fuck and shit words, and I am pretty gratefull for the universe for that. Tones of reasons. Particulary, for a mysterious one, I had to implement in Silverlight a custom filter for a List-based element.
So, let suppose that you are the lucky one who has to build a ComboBox, something like:

…and after selection is made, display something like:

…or, if a single item is checked:

…display the item itself:

I spent 6-7 hours on this issue, as it follows:

  • 1 hour search on the net for something usefull; usefull means, of course, a copy/paste routine. I didn’t find. It looks like I am the single human facing that problem.
  • 2 hours drinking coffe, smoking and thinking very deep on why?, why should I have to do this… Yep. I finally got the expected explanation: a fucking butterfly-effect. 1 million years ago a nice carnivor simply missed the gran-gran-gran…-gran-gran mother of one of my relatives, a blondie so called the mitocondrial Eve. Lucky me.
  • 3 hours implementing stuf for the Combo-Check-Box mutant above. Sorry for mentioning this one…
  • some time smoking again, just for fun and hoping that my ex will know somehow that I still smoke. Don’t know what this should be counted for, but I had fun on this.:)

Ok.
Some stuff explaining why this should not be possible are here:

http://www.jigar.net/articles/viewhtmlcontent328.aspx

http://msdn.microsoft.com/en-us/library/ms668604(v=vs.95).aspx

http://stackoverflow.com/questions/7999317/silverlight-combobox-with-checkboxes-items

I am not very sure that you are interested on how I did it, but just in case, here are the basic stuff.
If you are a female and you are still reading these, something is definitively wrong with that butterfly-effect :-)

1. Define a class implementing INotifyPropertyChanged

public class FilterOption: INotifyPropertyChanged
{
bool _use = false;
public bool use
{
get { return _use; }
set{
if (value != _use)
{
_use = value;
onPropertyChanged(this, “use”); }
}
}

public string _field;
public string field
{ get{ return _field;}
set{
if(value!=_field){
_field=value;
onPropertyChanged(this, “field”);
}
}
}

bool _show = true;
public bool show
{
get { return _show; }
set
{
if (_show != value)
{
_show = value;
onPropertyChanged(this, “show”);
}
}
}

public string abr { get; set; }

public event PropertyChangedEventHandler PropertyChanged;
private void onPropertyChanged(object sender, string propertyName)
{
if (this.PropertyChanged != null)
{
PropertyChanged(sender,
new PropertyChangedEventArgs(propertyName));
if(propertyName.Equals(“show”))
PropertyChanged(sender,
new PropertyChangedEventArgs(“visibility”));
}
}

public Visibility visibility
{
get
{
return show ? Visibility.Visible : Visibility.Collapsed;
}
}
}

2. Define the ItemsSource

List FiltersOnTasks = new List();

private void SetFilters()
{
FiltersOnTasks = new List()
{
new FilterOption(){ use = true, field=”All”, abr=”All”, show=true },
new FilterOption(){ use = true, field=”Task name”, abr=”Tsk”, show=true },
new FilterOption(){ use = true, field=”Account”, abr=”Acc”, show=true },
new FilterOption(){ use = true, field=”Project”, abr=”Prj”, show=true },
new FilterOption(){ use = true, field=”Activity”, abr=”Act”, show=true },
new FilterOption(){ use = true, field=”Description”, abr=”Dsc”, show=true }
};
if (cmbFilter != null)
{
cmbFilter.ItemsSource = new ObservableCollection(FiltersOnTasks);
cmbFilter.SelectedIndex = 0;
}
}

3. XAML stuff

4. Combo-Check events

private void cmbFilter_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//Important: nothing to do here :-)
}

private void chkFilter_Checked(object sender, RoutedEventArgs e)
{
SetFilterSelected(sender);
}

private void chkFilter_Unchecked(object sender, RoutedEventArgs e)
{
SetFilterSelected(sender);
}

private void SetFilterSelected(object sender)
{
if (sender is CheckBox)
{
string originalField = (sender as CheckBox).Tag.ToString();
bool origianlIsChecked = (sender as CheckBox).IsChecked != null ? (bool)(sender as CheckBox).IsChecked : false;
ObservableCollection list = (ObservableCollection)cmbFilter.ItemsSource;

string multipleFields = “”;
string lastCheckedField = “”;
int noChecked = 0;
for (int i = 1; i 0 ? “, ” + list[i].abr : list[i].abr);
noChecked++;
lastCheckedField = list[i].field;
}
}
else
{
if (list[i].use)
{
multipleFields += (multipleFields.Length > 0 ? “, ” + list[i].abr : list[i].abr);
noChecked++;
lastCheckedField = list[i].field;
}

}
}
if (noChecked == list.Count – 1)
multipleFields = “All”;
if (noChecked == 1)
multipleFields = lastCheckedField;
if (noChecked == 0)
{
multipleFields = “All”;
for (int i = 1; i < list.Count; i++)
list[i].use = true;
(sender as CheckBox).IsChecked = true;
}

list[0].field = multipleFields;
if (cmbFilter.SelectedIndex != 0)
cmbFilter.SelectedIndex = 0;
}
}

private void cmbFilter_DropDownOpened(object sender, EventArgs e)
{
((ObservableCollection)cmbFilter.ItemsSource)[0].show = false;
cmbFilter.UpdateLayout();
}

private void cmbFilter_DropDownClosed(object sender, EventArgs e)
{
((ObservableCollection)cmbFilter.ItemsSource)[0].show = true;
cmbFilter.SelectedIndex = 0;
cmbFilter.UpdateLayout();
}

5. Filtering stuff

….supposing that MyTask includes in definition some fields like account, project etc.
private List DoFilterText(List _data)
{
string filter = txtFilter.Text.ToLower().Trim();

bool useAccount = UseFilterOn(“acc”);
bool useProject = UseFilterOn(“prj”);
bool useTaskName = UseFilterOn(“tsk”);
bool useDescription = UseFilterOn(“dsc”);
bool useActivity= UseFilterOn(“act”);
if (useAccount || useProject || useTaskName || useDescription || useActivity)
{
List x = _data.Where(t =>
(useAccount && t.account.name.ToLower().IndexOf(filter) > -1) ||
(useProject && t.project.name.ToLower().IndexOf(filter) > -1) ||
(useActivity && t.activity.name.ToLower().IndexOf(filter) > -1) ||
(useDescription && t.description.ToLower().IndexOf(filter) > -1) ||
(useTaskName && t.taskname.ToLower().IndexOf(filter) > -1)).ToList();
return x;
}
return _data;
}

private bool UseFilterOn(string _abr)
{
FilterOption filter = FiltersOnTasks.Where(f => f.abr.ToLower().Equals(_abr.ToLower()) && f.use).FirstOrDefault();
return filter!=null && filter.use;
}

That’s it.
……..and what about Frank Sinatra? – will ask someone ( I suppose that a carnivore is still desperately looking for him…).
Well.
Just because he did it his way, no copy/paste there….
……..so what? – could answer that one, who surely was recently escaped from zoo.
Fuck you, Eve!

 

(c) marius09.wordpress.com
free counters
(c) 2009 marius09.wordpress.com

Me, jQuery, UpdatePanel and Frank Sinatra

December 18, 2010

It was decided that I have to suffer that Sunday. A cold, dark Sunday. A Sunday when each responsible creature on Earth should silencefully rest, hidden behind the frige and drinking something usefull for his own health. Tip for today: red wine.

Anyway. Forget about wine, ok?
Ok….
I’m not sure who answered, but shame on him.

Now, let overview what we got until now: it was a cold Sunday and no red wine around.
Here we go.
I will not mention the reason for which it was a bloody need to use a CheckBoxList on an unlucky web-page, having the following really funny behaviour: when checking an item, then the related label should be displayed bolded.

Css and some jQuery, right?
Nope guys. My control is placed inside of an UpdatePanel, and, of course, after a “partial” postback it has lost all jQuery prescripted behaviour.

So, I’m happy to popularize the solution for this crazy problem. It offered me the opportunity to experiment how the hell might be, and I had also the chance to understand what I would be capable for in moments of insanity. I discovered, during the two hours I have dig on this, my native talent on cursing, yielling and on producing of a lot of new words starting with our mutual favourite, f***.

Anyway, have here bellow a complete solution. Hope you read this after your two hour for experiencing the madness :)
CSS

.ctglist{font-family:Arial;}
.ctglist td{ padding-right:10px;}

ASPX code

………….
<script src=”jquery.min.js” type=”text/javascript”></script>
<script src=”myjquery.js” type=”text/javascript”></script>
………….
<asp:UpdatePanel/>
<asp:ContentTemplate/>
…………………………………
<asp:CheckBoxList ID="ctl00_HovedCP_cblC’" runat="server" CssClass="ctglist” />
…………………………………
<asp:Button ID=”btnSelect” runat=”server” Text=”Do postback, dude!” onclick=”VeryCleverStuff” />
<asp:ContentTemplate/>
<asp:UpdatePanel/>
………….

myjquery.js

$(document).ready(function() {
if ($(‘#ctl00_HovedCP_cblC’).length)
{
var sub = $(this).parent().find(‘label’);
$(‘.ctglist input:checkbox’).each(function(){
if( $(this).attr(‘checked’)){
sub.css({ ‘font-weight’ : ‘bold’ });
}
else
{
sub.css(‘font-weight’,'normal’) ;
}
});

$(‘.ctglist input:checkbox’).click(function(){
var sub = $(this).parent().find(‘label’);

if( $(this).attr(‘checked’) && sub != null){

sub.css({ ‘font-weight’ : ‘bold’ });

}
else
{
sub.css(‘font-weight’,'normal’) ;
}

});

}
});
ref.: http://www.dotnetfunda.com/articles/article471-jquery-and-aspnet-ajax-updatepanel-.aspx

function pageLoad(sender, args)
{
if(args.get_isPartialLoad()){
DoCheckListBoxStuff();
}
}

function DoCheckListBoxStuff()
{
if ($(‘#ctl00_HovedCP_cblC’).length)
{
$(‘.ctglist td input:checkbox’).each(function(){
var sub = $(this).parent().find(‘label’);
if( $(this).attr(‘checked’)){
sub.css(‘font-weight’,'bold’) ;
}
else
{
sub.css(‘font-weight’,'normal’) ;
}
});

$(‘.ctglist input:checkbox’).click(function(){
var sub = $(this).parent().find(‘label’);

if( $(this).attr(‘checked’) && sub != null){

sub.css({ ‘font-weight’ : ‘bold’ });

}
else
{
sub.css(‘font-weight’,'normal’) ;
}

});

}
}

Let drink now, what the f***!

:( …And what about Frank Sinatra? , will ask a reader (99% a lady, 99,999% a blondie one).

Nothing special, my beloved reader, we just had to be 4, like in Beatles, right?….So, let it be… let it beeeeeee…
Cheers! Happy New Controls! :)

 

 

(c) marius09.wordpress.com
free counters
(c) 2009 marius09.wordpress.com

The fucking MacDelete from the clan MacButtonField

January 16, 2010

This is the story of a ButtonField called Delete, a dark creature which was born in an age of web warriors and of millions of billions of cruel click-ers.

Delete was at his first incarnation on the planet Earth. He, because it is a he, didn’t have the opportunity to choose its name or its planet or its tooltip. But because I enjoyed a lot the Saw movies, I placed it into a GridView, setting its destiny to delete. It doesn’t matter what. Just delete and wait. And delete again after a while. Like a serial killer.

Well, I suppose that you heard about stupid .NET and also about the stupid armies of those guys drinking tones of beers and taping stuff on theirs evil laptops. A lot of loosers programming whatever a bits eater would like to eat. In this world I created my own armies of Frankesteins and I am pretty comfortable with the idea that tomorrow I will create several more. Just for fun. And, maybe, to get some money to be loved ;) .

Sorry, I forgot about the poor creature that I have unleashed today, the stupid MacDelete from the clan MacButtonField.
I gifted him with a nice ImageUrl and, with a couple of tears in the corner of my eyes and of my nose I wished him the best in his future life.

And life decided to move on… I completely forgot him, building new and new ways of looking on the walls… this way an eternity of 5 minutes passed on, and, finally, I decided to test my new slave.

Well, well, well. Bad news guys.

Point is that:
1. ToolTip property doesn’t work in FireFox or Google Chrome.
2. It does not respond at click event under IE 8.
Briefly: a shit.

Therefore I had to suddenly kill my temporary hero, the MacDelete from the clan MacButtonField and gloriously replace something else. Maybe a TemplateField from templier knights toolbox :) , maybe something else…

But… nope!
I got the trick!
1. set Type=Link
2. set Text=” img src=’….’ title=’TOOLTIP’ “….

and that’s all, folks!
It works! Same technique that one can use in TreeView-controls, for creating contextual-menus for nodes, or that another one would use to become a happy being just escaped from a psychiatric sanatorium.

….fucking Bill with a PacPac from the clan MacMac!

:( And what about the MacDelete? He was the hero?, would ask one of my blondie readers
:) Yep, sweetie, I would answer. Just click there and be happy!

 

(c) marius09.wordpress.com
free counters
(c) 2009 marius09.wordpress.com

Kill Bill 3

July 5, 2009

 
Good idea!
I started to hate Bill when I was a young, an unbelievable young programmer which used to ask everybody and every single day:

:( Why Windows…? Doors would sound better!

Do I have to say anything about this stinky Vista?
Of course I have to. Keep for posterity the equation bellow:
             Vista = Shit * N,
where:

  • Vista stays for, imagine!, Vista
  • Shit stays for an average, ambigous but nice coloured shit
  • N stays, of course, for the number of sell copies.
  • A while ago Bill decided to make my life a little bit more complicated. I suppose he had good reasons, maybe he was angry because I said once, while drinking a beer with another tortured creatures, that it’s sad that Bill is mad.
    And maybe he overreacted with…
    ...so what?
    I really didn’t feel like a victim. Maybe I should, but, honestly, I didn’t.

    Therefore, I quickly organized a conferrence in a pub called Sausage and beer and, together with my pals we voted 100% that we don’t fell at all like victims.
    Next step was to send an email to Bill informing him that we are not victims and that we would like that him to take back his pic from our screens:

    Dear Bill,
     
    We would like to have a meeting with you to kick your ass. Please see when you have some time, this is pretty urgent for us.
     
    Best regards,
    marius01, marius02, marius03, marius05, marius06, marius07, marius08, marius09, marius10, marius11, marius12, …, marius12671, …, marius982345687755

    The answer came fast:

    Dear marius09,
     
    I was sick last days, I layed in my bed all days long playing with my stubs and watching at some Scooby-Doo cartoons.
    I am sorry that I cannot join you at “Sausage and Beer” pub to apologize for my misearble business. I plan to sell Microsoft in the very next century and I’m working hard to get some guys from Mars to take over my company.
    Meanwhile, please enjoy as much as you can my software counterfeiting message, it’s my tribute for all humans that are unreasonably happy nowadays.
     
    Somehow sincerely yours,
    Bill

    We knew that he is a busy man, but we didn’t expect that he declined our invitation at Sausage and Beer.
    This way arises the common idea to get from Mr. Tarantino a new movie, Kill Bill 3.

    We will send him our script soon.

     

    (c) marius09.wordpress.com

    Thanx

    http://www.mydigitallife.info/2006/04/26/disable-and-remove-windows-genuine-advantage-notifications-nag-screen/
    Download also RemoveWGA.exe, it is the best in removing particulary this crazy stuff copyrighted Bill Gates.
    Of course, another choice is to launch your DOS screen and to type format c:.
    Choose the second one, pal!

    free counters
    (c) 2009 marius09.wordpress.com

    Winggy Wing reloaded

    June 11, 2009

    A small message wrote with a crooked finger on the dust of my monitor awared me this morning:
    I’m back!
    Winggy Wing after a lipo-suction
    That moment I knew that Winggy Wing did return. Because is hard to hide or to move to another apartment in such a short time, I decided to face her and to teach her a lesson of dignity.

    Therefore I came back from my job and I screamed, as usual:
    Fuck! Fuck! Fuck! Fuck! Fuck! Fuck!

    Then, with a smile in the corner of my virile mouth, I said:
    Come out, Winggy! Repair that!
    And I added about 84 more Fuck!s.

    This wasn’t fair at all!, said a voice and Winggy suddenly appeared through the walls.
    I don’t care, it’s your job to protect me, so do it, bitch!, I said laughing a lot in my inner forum.
    But why, honey, why?, asked her.
    Because of Prizee, this is why! And all is your fault.
    Of course, she said, let me see what is all this about. Tell me everything, we’ll get a solution.
      Hello! My name is Winggy Wing and I nicely start to sing


    Ok, remember our last discussion? I have more news related to this damn game.

    First of all, let see a more actual graphic of bubz, got between the dark age between Silver 4 and Gold 2 ranks.
    bubz, bubz and more bubz!

    You discovered the “ultimate formula” of the game
    Bubz = 0,0274 * DayNo + 25,562
    R^2 = 0,9791

    ..and I was happy a while. A short moment.
    Then I started to think about relations and rules that acts between the classes of bubz.

    I said: Let study a little bit the main classes of bubz, 0-10, 11-20, 21-30, 31-40, 41-50, 51-60, 61-70, 71-80, 81-80, 91-100 & over 101. If I consider my daily earned bubz as an instance of one of these classes, maybe I’ll be more closer to the mastermind behind Prizee.
    And this is what I done.
    For instance, if in day #414 I got 33 bubz, then day #414 will be labeled with class 31-40. This way we get a sequence of classes instead of a sequence with numbers.
    This is pretty funny, because the next step is to represent in terms of graphs the relations between these classes.
    classes of bubz
    Interesting, this is a connected graph having the incident matrix
    incidence matrix

    Ok, it’s a small step for man, but a huge one for… dolphins. Because mankind has different stuff to do.
    Now, we get the background for detecting the behaviour of each class. Because the graph built is a very common random graph, let generate random paths on it and see what kind of distribution we get for each node/class. It would be like 1000 users would play based on the statistics hidden in the early displayed bubz per day data.

    Good plan. But how?

    Simulating plays under the control of statistics bubz per day produces our first nice result:

    ;)   Result #1 
    Each class of bubz is instantiated based on a normal repartition.

    These are pretty good news related to the honestity of the people who give us our daily bubz.
    Of course, it matters a lot the average and the standard deviation of the repartition, but what the hell!, in a way or another, if we play enough, we will get “for sure” any instance of the classes. I mean all! For sure you will get a day when you will get less than 10 bubz, and this – doesn’t matter if you are Platinum 4 ranked! Of course, the probability is small, but it still exists.

    In my case, the probability of getting less than 10 bubz is about 4%, and to be honest, in about 150 days it happened once, in the darked day #526. On the other hand, in the early days of of Bronze rank, it happened many, so painfull many times…

     
     
    You can see beside an example of a beautifull Gaussian bell for the class 61-70.

    See the rest of distributions bellow.

    gauss_61_70

    This is the behaviour of each class of bubz, ok.
    What about the relationsships between them? If, let say, if today I make 42 bubz (therefore an instance of class 41-50), what should I expect from the day of tomorrow? Ok, I have an formula which estimates me a certain amount of bubz, but I want more!

    Actually, it would be nice to have what could be called the genealogy tree of the bubz.
    Obviously, some classes of bubz are more appropiated by another ones, more often it happens that after a day when you get something between 21-30 bubz the next day or the previous one you got something from 41-50 or 11-20. Basically, it is the ancient say that “a trouble never comes alone” – or something like that. If there is no such a say, it should be created.
    Well…

    Ok, here it comes the nicier part of applying the great neighbour-joining algorithms.
    I will come back later with some small details on this and also on the metric used. If you want to get an idea about what this metric is and how it is related to the the neighbour-joining algorithm see

  • An Eficient Approach for the Rank Aggregation Problem
  • A low-complexity distance for DNA strings
  • written by an interesting math guy called Liviu P. Dinu.
    Anyway, I used his metric – which actually is one of a common-sense with some really astonishing results in genetics.

    Ok, here we go. Bellow you get the data processed in a very primitive way.
    On the first hand, the table of neighbour occurrences:
    data_occurrences
    On the second hand, the rankings of each class based on its neighbours:
    data_rankings
    I was a little bit forced to work with characters (A,B,…,K) instead of ordinary numbers (1,2,…,11) for fetching data with my app. Anyway, A stays for 1, B for 2,…, K for 11 and the meaning of the row 41-50 DECBFGAHIJK, for instance, related to class 41-50 is this one: class 0-10 is the 4th/D ranked from occuring as a neighbour for class 41-50, class 11-20 is 5th/E ranked, class 21-30 is 3rd/C ranked and so on up to class over 100 which is 11th/K ranked from the same neighbour point of view.

    Pretty exciting.
    Now we can run our small .NET app and get this genealogy/philogenetic tree of classes of bubz.

    ;)   Result #2 
    The genealogy tree of classes of bubz is:
    hierarchy

    It can see the “balancing” way of acting of the bubz generator. As a famous Prizee player, Mr. Fazikowi, said in a certain moment of his life, if you get something poor in bubz today, let say 8 bubz, it’s pretty probable that yesterday/tomorrow you got/will get about 60-70 bubz.
    Of course, the general formula published in the previous post acts very ok, but in a statistical way. Concretelly, today or tomorrow there are good chances to get bubz in the most appropiated “relative” class to the one I instanciated today.
    Got it?

    Winggy!
    What the fuck are you doing while I’m speaking here…..?
    crazy Winggy Wing

    (c) marius09.wordpress.com

    Thanx!
    Pics above were collected from:
  • http://www.imagehousing.com/image.php?file_thumb=http://img396.imageshack.us/
    img396/7388/cce730aa16309b2c4dfc3ecqw0.th.gif&cat=angel
  • http://www.imagehousing.com/image.php?file_thumb=http://img152.imageshack.us/img152/6056/
    3e6b90a86a43e51015521dczy7.gif&cat=funny
  • :)   Normal distribution for each class of bubz 
     
    gauss_00_10gauss_11_20gauss_21_30gauss_31_40gauss_41_50gauss_51_60gauss_61_70gauss_71_80gauss_81_90gauss_91_100gauss_101_infinite

    :)   Info for next generation of prizeefobia  
     

    Prizee is a nice French site hosting a set of Flash games. As everywhere in this part of universe, you create an account and start to play. What to play? Well, there is a standard set of different games and you get only one of each per day, for free. If you want more, then you pay and get more. It is about you, I am too parsimonious.
    Winning a game will put some bubz in your bag. When you get a certain amount of bubz, you can order various gifts.
    Try it, if you really need to lose some time…

    :)   More info about Kolmogorov test & the other algorithms 
     

    …I’ll be back on these. :) Anyway, the net is full of examples and discussions around these topics ;)

    :)   Evolution of population of Winggy Wing’s fans 
     
    June 11th
    June 15th
    June 16th
    map_4_090616
    June 16th, late...
    free counters
    (c) 2009 marius09.wordpress.com

    Shakespeare in bits II

    April 12, 2009

    This one adds some bits more to one of my previous post.
    Just for fun, it displays simillarities between rolling characters / personages between Shakespeare’s plays.

    neighbor-joining algorithm applied for Shakespeare-s plays, under certain data-rank distance

    Code behind was written in .NET (C#), under neighbour-joining algorithm.

    Update #1
    I was almost to break my neck trying to read what is written in the pic above.
    I tried also to switch the monitor 90 degrees, but it still hurted me. Therefore I decided to add a second pic, especially for people that live in harmony with theirs necks…

    protect your neck!

    Copyright © 2009 Marius Iancu @ Revue Roumaine de Linguistique
    Cahiers de Linguistique Théorique et Appliquée
    free counters
    oop! Copyright ©2009 http://marius09.wordpress.com
    show me the money!

    Random graphs (2/4)

    February 17, 2009

    This is the next generation of Random graphs (1/4). Surprisingly, isn’t it?…: 2/4 after 1/4, is something like descovering together upper bounds of mankind… Personal remark: keep doing good job and follow links in this small delirium therefore my hitting indexes will increase and I will be happy, feeling love all around…

    Graphs taken into account are produced following specs from [5], [6]. Needed randomness come from results like [5], Theorem 1 (maybe some more extensions would be welcomed, but it is good enough for the moment) and also from philosophy behind pseudo-random generators (see for instance [7], Pseudo – Numbers chapter).

    some mathematicians deciding stuff... (http://images.allmoviephoto.com/2003_The_Jungle_Book_2/2003_the_jungle_book_2_011.jpg) So, which is the plan…?

    This one remembers me about the several vultures hanging over a branch, in golden Jungle books movie, asking each other What you wanna do, what you wanna do..?.

    Let notice first of all that entropy itself is exactly a mathematical estimator for function u(x) = -log(p(x)):

    Entropy = -\mathbb{E}[\log_2 p(X)] = -\displaystyle \sum_{x \in X} p(x)\cdot \log_2{p(x)}

    where X is a random variable and E denotes mathematical expectation for function u. Herein, p denotes a probability density function over X. Note that base 2 of the logarithm is not very significant. However, because it sounds more gorgeous to have bit(s) as unit(s) to whatever measure, we can agree on this particular base.

    Hence, according with Shannon, it should be the average information got when unleash a random experiment to produce itself inside a graph, along its edges or inside its nodes. This is why it is very important that the random background to be achieved: whatever we would like to measure inside the graph as information entropy, it has to reflect a random process developed inside the graph. It is out of reason to talk about whatever kind of information sample inside a static structure. This is why Dehmer papers [1],[2],[3] are actually retarded language from a dying species: they not reflect (or at least don’t sustain) a dynamic process. To reflect the structure of a graph through entropy in the lacking of defining a process is the same with making love with a ghost.
    Therefore, point is: what process can be defined as a natural prolong of a definition of a graph?
    I feel you suspect me that I know the answer. You feel I suspect you that you don’t think that… A very complex world…
    Anyway, is time to go to work. I hate this, also today. Hope you believe me.

    Bibliography
    [5] On Generating Random Network Structures: Trees Alexy S. Rodionov, Hyuseung ChooP.M.A. Sloot et al. (Eds.): ICCS 2003, LNCS 2658,pp 879-887, 2003 © Springer-Verlag Berlin Heidelberg 2003
    [6] Generating Random Trees and Connected Graphs (posted by a usefull guy called Juan Antonio)
    [7] Introduction to Statistics Ewa Paszek

    …see also this nice approach:
    Random Graphs: The Basic Models – Sarvagya Upadhyay

    free counters
    Copyright ©2009 Marius Iancu (http://marius09.wordpress.com)

    Update (March 06)
    I discovered use of LaTeX inside wordpress, therefore I played a little with it (I mean with LaTeX..) and, suddenly, some minor changes occured, comparatively to the original text.
    If you really miss the original text, just notify me and I will try to send you a diploma and, of course, a medal.

    Here bellow are some great links one mab’lord (math blogger in wordpress – following StarWars nice way of naming stuff) would use:

    Symbols http://omega.albany.edu:8008/Symbols.html
    Commands http://www.artofproblemsolving.com/LaTeX/
    AoPS_L_GuideCommands.php
    WordPress ref. http://support.wordpress.com/latex/

    Random graphs (1/4)

    February 9, 2009

    These days i tryed to figure out several issues on defining entropy/information measures on graphs. (it happens from time to time, to deeply think on humanity problems; result is a very proud and noisy sleep – neighbours allways know that I deal with some fundamentals stuff).

    There are several approaches that seem very artificial to me (Dehmer [1],[2],[3] and maybe more than those…). This is still not very tragically, due to the fact that many things are even more artificially…
    Problem in defining entropy in terms of different metrics in a graph, and afterwards claim hundreds of relations between hundreds of quantities is simply garbage, in my opinion…. unless of a basic check of the meaning of defined quantities…
    Why not, for instance, to define as entropy in a connected graph G=(V,E) something like:
    (*) Entropy(G) = sum{d(v1)*sqrt( ln(max(d(v2)),l(v1,v2)))], sum performed for all edges (v1,v2) from E ; d(x) is the degree of vertex x ; sqrt is squared value ; l(v1,v2) = the longest path of distinct vertexes between v1 and v2 (…not to many maths symbols allowed here – but anyway, ideas are more or less important). …I bet that one can produce at least 10 interesting inequalities related to (*), based on |V|, |E| and, maybe, on the number of words Jay Leno said last Saturday night…
    Issue is that a very strong concept – like entropy – has to be carefully integrated with graphs structure and metrics. From my point of view, [3] is the perfect example of an useless and hopeless approach. We can produce 100000000000 similar results, starting with different “functionals of information” (…yeah!, bad luck, don’t mention it again…).

    So, what can be done? – I don’t know, but let try something statistically. Maybe a Monte Carlo algorithm applied for a random graph, maybe verifying statistical hypothesis (as the distribution over vertex space) – anything… What and who (excepting authors like Mr. Dehmer) could certify that a certain measure measures what it suppose to measure? Uncertaintity of a graph structure…for instance…? What is uncertainty of a graph? I think the original Shannon[4] meaning of signal propagation should be maintained unless serious work would reveal a new significance.
    Seems obviously that any start should be done inside random graphs area – randomness seem to be the natural background to whatever information measure we would like to suggest/check/publish/become rich/buy an island in Bahamas/get cars, women and more cars…./get Nobel/ more islands/ more cars…

    Just for fun, here bellow are some random graphs. All generated in .NET following some algorithms I will talk about in next post. Yes, I did the programming and I proudly share the code with anybody excepting Mr. Dehmer…. Anyway, something nice coming from these Dehmer papers: I like the draws and metaphors behind j-Spheres definitions…. Is something like: someone publishes in front of his article that instead of “cow” that he will use something like “delta-vertebrate-muuuuu! based”… why? no one knows… but it still sounds funny: “j-Spheres”… wow! it remind me by Star-Treck, with a very retarded captain Picard comitting suicide because of claustrophobia…
    Therefore, here bellow are some beautifull random connected graphs generated by what I will call j-NET app….. (seriously, I like the j-metaphor…):

    g100

    g1_300x1200
    …some zoom-in is welcomed, I suppose:
    g1_300x1200_detail

    And finally, some j-something (for a 50-vertex graph, having 100 random generated edges):
    j_50x100

    ..I will be back on the algorithm of random generating graphs, it is very important to have a mathematical support for the “random” word, in order to approach the spirit of Shannon theory…
    Referrences (unbelievable!, I am proud of me!)
    [1]
    Information processing in complex networks:
    Graph entropy and information functionals
    – Matthias Dehmer

    [2]
    New Topological Information Indices Based on the Full Neighborhood of All Atoms – Matthias Dehmer & colab.

    [3] Entropy Bounds for Hierarchical Molecular Networks- Matthias Dehmer & colab.
    [4] A Mathematical Theory of Communication – Claude Shannon

    free counters
    Copyright ©2009 Marius Iancu (http://marius09.wordpress.com)
    yep! yep! yep!

    Follow

    Get every new post delivered to your Inbox.

    Join 49 other followers