Tuesday, June 22, 2010

Created Issue: Hiding and Showing a column with a TextBlock as the header causes exception [13589]

Created Issue: Hiding and Showing a column with a TextBlock as the header causes exception [13589]: "If you set a column header to a text block (rather than a string), and you set the visiblity of the column to collapsed, then later set the visibility back to Visible grid gives an invalid operation exception "Specified element is already the logical child of another element. Disconnect it first." Below is complete code for a program to demonstrate. Run the program, click the three buttons in order.

<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>

</Grid.RowDefinitions>
<DataGrid AutoGenerateColumns="True" Name="dataGrid1" ItemsSource="{Binding}"/>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button Click="SetTextBlocks_Click">Set Headers to TextBlocks</Button>
<Button Click="Hide_Click">Hide Weight Column</Button>
<Button Click="Show_Click">Show Weight Column</Button>
</StackPanel>
</Grid>
</Window>

Code Behind:

using System.Windows;
using System.Windows.Controls;
using System.Collections.ObjectModel;

namespace WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{

InitializeComponent();

ObservableCollection<Item> Items = new ObservableCollection<Item>();
Items.Add(new Item(1, "John", 200));
Items.Add(new Item(2, "Mary", 100));
Items.Add(new Item(3, "Jane", 150));
DataContext = Items;


}

public class Item
{
public int ID { get; private set; }
public string Name { get; private set; }
public double Weight { get; private set; }

public Item(int id, string name, double weight)
{
ID = id;
Name = name;
Weight = weight;
}
}

private void Hide_Click(object sender, RoutedEventArgs e)
{
dataGrid1.Columns[2].Visibility = System.Windows.Visibility.Collapsed;
}

private void Show_Click(object sender, RoutedEventArgs e)
{
dataGrid1.Columns[2].Visibility = System.Windows.Visibility.Visible;
}

private void SetTextBlocks_Click(object sender, RoutedEventArgs e)
{
TextBlock temp = new TextBlock();
temp.Text = "ID X";
dataGrid1.Columns[0].Header = temp;

temp = new TextBlock();
temp.Text = "Name X";
dataGrid1.Columns[1].Header = temp;

temp = new TextBlock();
temp.Text = "Weight X";
dataGrid1.Columns[2].Header = temp;
}
}
}
"

Sunday, March 14, 2010

Apple OS Learning to Chew Gum and Walk at the Same Time, Multitask Support Coming - HotHardware

Apple OS Learning to Chew Gum and Walk at the Same Time, Multitask Support Coming - HotHardware

Posted using ShareThis

Monday, March 8, 2010

Goole Map WPF windows application


Dear all

a very helpful windows based google map application , this can be used just like web based google map but no need of a browser and an added extra IP search location which is not available in google map.


Click to download the application

Wednesday, March 3, 2010

Sms to India using Way2Sms PHP code


Click to download windows exe



$post_data = "username=username&password=pwd";
//$header_array[]="User-Agent:
$url = "http://wwwa.way2sms.com/auth.cl";
$cookie = tempnam ("/tmp", "CURLCOOKIE");
$ch = curl_init();
curl_setopt( $ch, CURLOPT_USERAGENT,"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5" );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded","Accept: */*"));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $ch, CURLOPT_ENCODING, "" );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
curl_setopt($ch,CURLOPT_REFERER,"http://wwwg.way2sms.com//entry.jsp");
$content = curl_exec( $ch );
$response = curl_getinfo( $ch );
//$ch = curl_init($url);
//echo $content;
$post_data = "custid=undefined&HiddenAction=instantsms&Action=custfrom450000&login=&pass=&MobNo=9986966496&textArea=test sms";
$url = "http://wwwa.way2sms.com/FirstServletsms?custid=";
curl_setopt( $ch, CURLOPT_USERAGENT,"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5" );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded","Accept: */*"));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $ch, CURLOPT_ENCODING, "" );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_MAXREDIRS, 0 );
$content = curl_exec( $ch );
$url = "http://wwwa.way2sms.com/jsp/logout.jsp";
curl_setopt( $ch, CURLOPT_USERAGENT,"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5" );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded","Accept: */*"));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $ch, CURLOPT_ENCODING, "" );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_MAXREDIRS, 0 );
$content = curl_exec( $ch );

?>

Tuesday, July 28, 2009

Google Wave

Google Wave is a new communication service previewed today at Google I/O. "A wave is equal parts conversation and document, where people can communicate and work together with richly formatted text, photos, videos, maps, and more."

The service seems to combine Gmail and Google Docs into an interesting free-form workspace that could be used to write documents collaboratively, plan events, play games or discuss a recent news.


Google Wave has been designed by the founders of Where 2 Tech, a start-up acquired by Google to create a cutting-edge mapping service, which later became Google Maps.

"Back in early 2004, Google took an interest in a tiny mapping startup called Where 2 Tech, founded by my brother Jens and me. We were excited to join Google and help create what would become Google Maps. But we also started thinking about what might come next for us after maps. As always, Jens came up with the answer: communication. He pointed out that two of the most spectacular successes in digital communication, email and instant messaging, were originally designed in the '60s to imitate analog formats — email mimicked snail mail, and IM mimicked phone calls. Since then, so many different forms of communication had been invented — blogs, wikis, collaborative documents, etc. — and computers and networks had dramatically improved. So Jens proposed a new communications model that presumed all these advances as a starting point.

"In Google Wave you create a wave and add people to it. Everyone on your wave can use richly formatted text, photos, gadgets, and even feeds from other sources on the web. They can insert a reply or edit the wave directly. It's concurrent rich-text editing, where you see on your screen nearly instantly what your fellow collaborators are typing in your wave. That means Google Wave is just as well suited for quick messages as for persistent content -- it allows for both collaboration and communication. You can also use "playback" to rewind the wave to see how it evolved."