Programmers with a good sense of humor

Two funny things I have discovered today.

First is an easter-egg in a trace route, from people at BeagleNetworks.net that have inserted the plot of Star Wars Episode IV in their internal routes. Just traceroot 216.81.59.173 to see what happens. Here is the listing:

The second is a funny error message when an error occurred while trying to unsubscribe from youtube. The message reads “A team of highly trained monkeys has been dispatched to deal with the situation.”
trainedmonkeys

2 Replies to “Programmers with a good sense of humor”

  1. Va salut,

    Cautam o solutie pentru o problema pe care o am cu un tabcontrol pe o fereastra WPF (in C#) si am dat peste site-ul dvs.

    Nu am gasit unde sa pun intrebarea asta asa ca o postez aici.

    Deci, pe o fereastra WPF am asta (o lista de nume cu tab-uri pentru fiecare litera)

    Codul C#:

    private void tabControlPatients_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
    if (e.OriginalSource is TabControl)
    {
    foreach (TabItem elementoTab in tabControlPazienti.Items)
    {
    //aici se blocheaza cu eroarea: “Cannot change cell selection when the SelectionUnit is FullRow” daca schimb in xaml SelectionUnit=”FullRow” in loc de SelectionUnit=”CellOrRowHeader”; adica daca schimb in FullRow merge
    elementoTab.Content = null;
    }

    ArrayList filtro = new ArrayList();
    filtro.Insert(0, ((TabItem)tabControlPatients.SelectedItem).Header.ToString());

    ((TabItem)tabControlPatients.SelectedItem).Content = loadPatReturn(userData, idCompany, filter);
    }

    }

    public DataGrid loadPatReturn(Person userData, int idCompany, ArrayList filter)
    {
    DbDataAdapter da = personDao.List(idCompany, filter);
    DataSet dataset = new DataSet();

    dataGridPatients.AutoGenerateColumns = false;
    dataGridPatients.IsReadOnly = true;

    da.Fill(dataset);
    dataGridPatients.ItemsSource = dataset.Tables[0].DefaultView;

    return dataGridPatients;
    }

    private void dataGridPatients_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
    int idPat = 0;
    DataRow datarow = null;
    DataRowView patSel = null;
    Person pat = null;

    if (dataGridPatients.SelectedItem == null)
    {
    return null;
    }

    patSel = (DataRowView) dataGridPatients.SelectedItem;

    try
    {
    datarow = patSel.Row;
    idPat = Convert.ToInt16(datarow[“id”].ToString());

    pat = new Person();
    pat.Id = idPat;
    }
    catch (Exception ex)
    {

    }

    return pat;
    }

    public void loadPat(Person userData, int idCompany, ArrayList filter)
    {
    DbDataAdapter da = personDao.List(idCompany, filter);
    DataSet dataset = new DataSet();

    dataGridPatients.AutoGenerateColumns = false;
    dataGridPatients.IsReadOnly = true;

    da.Fill(dataset);
    dataGridPatients.ItemsSource = dataset.Tables[0].DefaultView;

    }

    Functionare:
    -cand se deschide fereastra WPF cu codul xaml de mai sus este selectionat item-ul cu litera A care contine un datagrid cu date incarcate cu metoda “loadPat”;
    -daca fac click pe o litera (un tab-item) setez valoarea “null” pentru continutul tuturor celorlate tab-item-uri iar pentru tab-itemul selectionat setez continutul la valoarea datagrid restituita de metoda “loadPatReturn”, adica datagrid-ul este acelasi pentru toate tab-item-urile.
    -daca fac dublu-clik pe o linie din datagrid se deschide o alta fereastra cu detaliile despre recordul selectionat (metoda dataGridPatients_MouseDoubleClick).

    PROBLEMA:
    cand fac dublu-click pe o linie in datagrid, metoda “dataGridPatients_MouseDoubleClick” imi restituie practic mereu “null”; daca fac dublu-click inca o data intr-o alta celula (pe aceeasi linie) atunci merge;
    Am schimbat “SelectionUnit” din “CellOrRowHeader” in “FullRow” si merge numai ca daca fac din nou clik pe un tab-item sus programul se blocheaza la linia in care setez continutul la valoarea “null” (vezi codul mai sus, metoda “tabControlPatients_SelectionChanged”) cu eroarea “Cannot change cell selection when the SelectionUnit is FullRow”).

    Va multumesc si va salut cu respect,
    Adrian

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.